Skip to content

Merge interflux to master#447

Closed
zeptin wants to merge 25 commits intostratisproject:masterfrom
zeptin:interflux-20210305
Closed

Merge interflux to master#447
zeptin wants to merge 25 commits intostratisproject:masterfrom
zeptin:interflux-20210305

Conversation

@zeptin
Copy link
Collaborator

@zeptin zeptin commented Mar 5, 2021

No description provided.

fassadlr and others added 20 commits January 20, 2021 13:56
* Initial InterFlux version

* Refactor
* Initial InterFlux version

* Update NBitcoin.csproj (stratisproject#391)

* Pass along height information for OP_FEDERATION (stratisproject#379)

* Pass along height information for OP_FEDERATION

* Add defaults

* Add defaults

* Filter Transaction History by Transaction Id (stratisproject#393)

* Update WalletService.cs

* Add Filter

* Fix Test

* Perform check for cold staking txs

* Refactor

* Modify DI sequence

* Add mainnet check points (stratisproject#400)

* Add MainNet check points

* Fix Tests

* Change gas limit upper bound to 250,000 (stratisproject#399)

* Add UInt256, serialization methods and CLR updates (stratisproject#365)

* Add UInt256 serialization methods

* Refactor

* Use UInt256 in InternalExecutor

* Undo unrelated change

* Update TestMessage

* Revert type updates to InternalExecutor

* Update Serializer and PersistentState

* Update package versions

* Update SC packages to version 1.4.0-alpha

* Add serializers and enums

* Add primitive serializer

* Update StandardToken.cs

* Revert change

* Update integration tests

* Use switch/case in Serialize/Deserialize

* Update package versions and remove workaround

* Ensure the right Stratis.SmartContracts.Standards is used by contracts

* Changes based on feedback

* Fix primitive deserialize

* Update standards dll name

* Fix legacy standards dll path

* Don't upgrade standards package of node

* Don't upgrade StandardToken of node

* Don't upgrade standards package of node

* Add Standards forwards compatibility

* Add test case for futuristic contracts

* Fix Token_Standards_Test

* Update RPC_GetReceipt_Returns_Value test

* Cleanup non-required changes

* Validate standards assembly

* Disable automatic downloads

* Add LegacyStandardsDLLs

* Update test

* Bump package versions for Core and Networks

* Bump observer version

* Update package versions

* Refactor

* Revert gitignore

* Revert unnecessary changes

* Revert unnecessary changes

* Update Stratis.SmartContracts.xxx to 2.0.0.0

* Update package version for Stratis.SmartContracts.Tests.Common

* Add TestNet checkpoints (stratisproject#402)

* Update StraxTest.cs

* Add testnet checkpoints

* Fix Tests

* Update Nuget Scripts and Collateral/FederatedPeg versions

* Bump Version (stratisproject#403)

* Update some test projects PackageIds and versions

* Update PushNuget.ps1

* Update MaxStandardSigOpsCost and CCTS Max Partials Txs (stratisproject#404)

* Update Stratis.SmartContracts.CLR.Validation's allowed primitive types (stratisproject#405)

* Update validator's primitives

* Bump package version

* Bump Stratis.SmartContracts.Core and Stratis.SmartContracts.CLR versions (stratisproject#406)

* Update validator's primitives

* Bump package version

* Bump Stratis.SmartContracts.Core and Stratis.SmartContracts.CLR versions

* Bump Stratis.Bicoin.Features.SmartContracts as well

* Bump Stratis.SmartContracts.Networks

* Update PushSCNuget.ps1

* Fix Finality Bug (stratisproject#407)

* Fix Finalized Bug

* Fix Build

* Trigger CI

* Fix Tests

* Comments

* Console Cleanup (stratisproject#408)

* Suppress bench logs

* Done

* Update NodeStats.cs

* Fix Test

* Bump version prior to fixing NuGet dependencies for  Stratis.SmartContracts.Tests.Common (stratisproject#409)

* Rocks DB (stratisproject#401)

* WIP

* Fix DB connections

* Update CirrusD

* Add RocksDbNative

* Update Stratis.CirrusD.csproj

* Add Snappy

* Fix BlockStoreQueue

* Add switch to program.cs

* Fix Logger

* Cleanup Console Logs

* Add RocksDbChainStore

* Update BlockPuller.cs

* Implement RocksDb KeyValueStore

* Add dbtype switch to StraxD

* NodeStats changes

* KeyValue fix

* Fix Build

* Voting / Wallet Log

* Update ConnectionManager.cs

* Hide bench stats

* Update VersionProvider.cs

* Self Review

* Fix Test

* Update ConnectionManager.cs

* Fix Locks in StakeDB

* Create RocksDbProvenBlockHeaderRepository

* Update RocksDbProvenBlockHeaderRepository.cs

* Add network type to console

* Fix Test

* Update NodeStats.cs

* Add datafolder to nodestats

* Fix Merge

* Revert

* Revert launchsettings

* Add ColdStaking to PushNuGet script (stratisproject#410)

* Add ColdStaking to PushNuGet script

* Bump Stratis.Bitcoin.IntegrationTests.Common to 1.0.7

* Bump Stratis.Core.Tests.Common to 1.0.7

* Update NEthereum and Stratis.Patricia

* SLN changes

* Clean up commits

* Remove launchSettings change

Co-authored-by: Francois de la Rouviere <fassadlr@gmail.com>
Co-authored-by: quantumagi <someguy.fromafrica@gmail.com>
* Initial InterFlux version

* Update NBitcoin.csproj (stratisproject#391)

* Pass along height information for OP_FEDERATION (stratisproject#379)

* Pass along height information for OP_FEDERATION

* Add defaults

* Add defaults

* Filter Transaction History by Transaction Id (stratisproject#393)

* Update WalletService.cs

* Add Filter

* Fix Test

* Perform check for cold staking txs

* Refactor

* Modify DI sequence

* Add mainnet check points (stratisproject#400)

* Add MainNet check points

* Fix Tests

* Change gas limit upper bound to 250,000 (stratisproject#399)

* Add UInt256, serialization methods and CLR updates (stratisproject#365)

* Add UInt256 serialization methods

* Refactor

* Use UInt256 in InternalExecutor

* Undo unrelated change

* Update TestMessage

* Revert type updates to InternalExecutor

* Update Serializer and PersistentState

* Update package versions

* Update SC packages to version 1.4.0-alpha

* Add serializers and enums

* Add primitive serializer

* Update StandardToken.cs

* Revert change

* Update integration tests

* Use switch/case in Serialize/Deserialize

* Update package versions and remove workaround

* Ensure the right Stratis.SmartContracts.Standards is used by contracts

* Changes based on feedback

* Fix primitive deserialize

* Update standards dll name

* Fix legacy standards dll path

* Don't upgrade standards package of node

* Don't upgrade StandardToken of node

* Don't upgrade standards package of node

* Add Standards forwards compatibility

* Add test case for futuristic contracts

* Fix Token_Standards_Test

* Update RPC_GetReceipt_Returns_Value test

* Cleanup non-required changes

* Validate standards assembly

* Disable automatic downloads

* Add LegacyStandardsDLLs

* Update test

* Bump package versions for Core and Networks

* Bump observer version

* Update package versions

* Refactor

* Revert gitignore

* Revert unnecessary changes

* Revert unnecessary changes

* Update Stratis.SmartContracts.xxx to 2.0.0.0

* Update package version for Stratis.SmartContracts.Tests.Common

* Add TestNet checkpoints (stratisproject#402)

* Update StraxTest.cs

* Add testnet checkpoints

* Fix Tests

* Update Nuget Scripts and Collateral/FederatedPeg versions

* Bump Version (stratisproject#403)

* Update some test projects PackageIds and versions

* Update PushNuget.ps1

* Update MaxStandardSigOpsCost and CCTS Max Partials Txs (stratisproject#404)

* Update Stratis.SmartContracts.CLR.Validation's allowed primitive types (stratisproject#405)

* Update validator's primitives

* Bump package version

* Bump Stratis.SmartContracts.Core and Stratis.SmartContracts.CLR versions (stratisproject#406)

* Update validator's primitives

* Bump package version

* Bump Stratis.SmartContracts.Core and Stratis.SmartContracts.CLR versions

* Bump Stratis.Bicoin.Features.SmartContracts as well

* Bump Stratis.SmartContracts.Networks

* Update PushSCNuget.ps1

* Fix Finality Bug (stratisproject#407)

* Fix Finalized Bug

* Fix Build

* Trigger CI

* Fix Tests

* Comments

* Console Cleanup (stratisproject#408)

* Suppress bench logs

* Done

* Update NodeStats.cs

* Fix Test

* Bump version prior to fixing NuGet dependencies for  Stratis.SmartContracts.Tests.Common (stratisproject#409)

* Rocks DB (stratisproject#401)

* WIP

* Fix DB connections

* Update CirrusD

* Add RocksDbNative

* Update Stratis.CirrusD.csproj

* Add Snappy

* Fix BlockStoreQueue

* Add switch to program.cs

* Fix Logger

* Cleanup Console Logs

* Add RocksDbChainStore

* Update BlockPuller.cs

* Implement RocksDb KeyValueStore

* Add dbtype switch to StraxD

* NodeStats changes

* KeyValue fix

* Fix Build

* Voting / Wallet Log

* Update ConnectionManager.cs

* Hide bench stats

* Update VersionProvider.cs

* Self Review

* Fix Test

* Update ConnectionManager.cs

* Fix Locks in StakeDB

* Create RocksDbProvenBlockHeaderRepository

* Update RocksDbProvenBlockHeaderRepository.cs

* Add network type to console

* Fix Test

* Update NodeStats.cs

* Add datafolder to nodestats

* Fix Merge

* Revert

* Revert launchsettings

* Add ColdStaking to PushNuGet script (stratisproject#410)

* Add ColdStaking to PushNuGet script

* Bump Stratis.Bitcoin.IntegrationTests.Common to 1.0.7

* Bump Stratis.Core.Tests.Common to 1.0.7

* Update NEthereum and Stratis.Patricia

* SLN changes

* Clean up commits

* Remove launchSettings change

* Add references

Co-authored-by: Francois de la Rouviere <fassadlr@gmail.com>
Co-authored-by: quantumagi <someguy.fromafrica@gmail.com>
* Update LaunchSidechainMasternode.ps1

* Update LaunchSidechainMasternode.ps1

* Update LaunchSidechainMasternode.ps1
* Update NBitcoin.csproj (stratisproject#391)

* Pass along height information for OP_FEDERATION (stratisproject#379)

* Pass along height information for OP_FEDERATION

* Add defaults

* Add defaults

* Filter Transaction History by Transaction Id (stratisproject#393)

* Update WalletService.cs

* Add Filter

* Fix Test

* Perform check for cold staking txs

* Add mainnet check points (stratisproject#400)

* Add MainNet check points

* Fix Tests

* Change gas limit upper bound to 250,000 (stratisproject#399)

* Add UInt256, serialization methods and CLR updates (stratisproject#365)

* Add UInt256 serialization methods

* Refactor

* Use UInt256 in InternalExecutor

* Undo unrelated change

* Update TestMessage

* Revert type updates to InternalExecutor

* Update Serializer and PersistentState

* Update package versions

* Update SC packages to version 1.4.0-alpha

* Add serializers and enums

* Add primitive serializer

* Update StandardToken.cs

* Revert change

* Update integration tests

* Use switch/case in Serialize/Deserialize

* Update package versions and remove workaround

* Ensure the right Stratis.SmartContracts.Standards is used by contracts

* Changes based on feedback

* Fix primitive deserialize

* Update standards dll name

* Fix legacy standards dll path

* Don't upgrade standards package of node

* Don't upgrade StandardToken of node

* Don't upgrade standards package of node

* Add Standards forwards compatibility

* Add test case for futuristic contracts

* Fix Token_Standards_Test

* Update RPC_GetReceipt_Returns_Value test

* Cleanup non-required changes

* Validate standards assembly

* Disable automatic downloads

* Add LegacyStandardsDLLs

* Update test

* Bump package versions for Core and Networks

* Bump observer version

* Update package versions

* Refactor

* Revert gitignore

* Revert unnecessary changes

* Revert unnecessary changes

* Update Stratis.SmartContracts.xxx to 2.0.0.0

* Update package version for Stratis.SmartContracts.Tests.Common

* Add TestNet checkpoints (stratisproject#402)

* Update StraxTest.cs

* Add testnet checkpoints

* Fix Tests

* Update Nuget Scripts and Collateral/FederatedPeg versions

* Bump Version (stratisproject#403)

* Update some test projects PackageIds and versions

* Update PushNuget.ps1

* Update MaxStandardSigOpsCost and CCTS Max Partials Txs (stratisproject#404)

* Update Stratis.SmartContracts.CLR.Validation's allowed primitive types (stratisproject#405)

* Update validator's primitives

* Bump package version

* Bump Stratis.SmartContracts.Core and Stratis.SmartContracts.CLR versions (stratisproject#406)

* Update validator's primitives

* Bump package version

* Bump Stratis.SmartContracts.Core and Stratis.SmartContracts.CLR versions

* Bump Stratis.Bicoin.Features.SmartContracts as well

* Bump Stratis.SmartContracts.Networks

* Update PushSCNuget.ps1

* Fix Finality Bug (stratisproject#407)

* Fix Finalized Bug

* Fix Build

* Trigger CI

* Fix Tests

* Comments

* Console Cleanup (stratisproject#408)

* Suppress bench logs

* Done

* Update NodeStats.cs

* Fix Test

* Bump version prior to fixing NuGet dependencies for  Stratis.SmartContracts.Tests.Common (stratisproject#409)

* Rocks DB (stratisproject#401)

* WIP

* Fix DB connections

* Update CirrusD

* Add RocksDbNative

* Update Stratis.CirrusD.csproj

* Add Snappy

* Fix BlockStoreQueue

* Add switch to program.cs

* Fix Logger

* Cleanup Console Logs

* Add RocksDbChainStore

* Update BlockPuller.cs

* Implement RocksDb KeyValueStore

* Add dbtype switch to StraxD

* NodeStats changes

* KeyValue fix

* Fix Build

* Voting / Wallet Log

* Update ConnectionManager.cs

* Hide bench stats

* Update VersionProvider.cs

* Self Review

* Fix Test

* Update ConnectionManager.cs

* Fix Locks in StakeDB

* Create RocksDbProvenBlockHeaderRepository

* Update RocksDbProvenBlockHeaderRepository.cs

* Add network type to console

* Fix Test

* Update NodeStats.cs

* Add datafolder to nodestats

* Fix Merge

* Revert

* Revert launchsettings

* Add ColdStaking to PushNuGet script (stratisproject#410)

* Add ColdStaking to PushNuGet script

* Bump Stratis.Bitcoin.IntegrationTests.Common to 1.0.7

* Bump Stratis.Core.Tests.Common to 1.0.7

* Update to Stratis.RocksDb (stratisproject#415)

* Prevent changing published packages w/o bumping local version (stratisproject#411)

* Prevent changing package code of published version - must bump version

* Update comments

* Small refactor

* Ensure Release folder exists

* Check version changes related to project references

* Bump versions

* Refactor

* Refactor

* Fix wallet feature vesion

* Update RocksDb dylibs (stratisproject#417)

* Update to Stratis.RocksDb

* Update to version 0.0.9.1

* Update RocksDb Nugets

* Update Rocksdb (stratisproject#418)

* Revert "Dont fetch/process deposits until the CCTS has cleared its suspended transfers (stratisproject#367)"

This reverts commit 334b4f0.

* Update Nuget

* Update CirrusMain.cs (stratisproject#422)

* Consolidate outstanding console changes for the MS/Miner (stratisproject#423)

* update RocksDb Nuget (stratisproject#424)

* Update Stratis.Bitcoin Assembly info to version 1.0.7.2

* Fix Seeder (stratisproject#425)

* Fix AddressIndexer Console (stratisproject#426)

* Update ConnectionManager.cs (stratisproject#427)

* Fix merge conflicts

Co-authored-by: Francois de la Rouviere <fassadlr@gmail.com>
Co-authored-by: quantumagi <someguy.fromafrica@gmail.com>
this.filterId = this.transferEventHandler.CreateFilterAsync(this.filterAllTransferEventsForContract).GetAwaiter().GetResult();
}

public List<EventLog<TransferEventDTO>> GetTransferEventsForWrappedStrax()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method and the one that calls it can be made async to avoid doing .GetAwaiter().GetResult(); in the code

Copy link
Contributor

@fassadlr fassadlr Mar 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noescape00 I suspect this is because of NEthereum's interface contract not being async or not returning Task? @zeptin can you confirm?


namespace Stratis.Bitcoin.Features.Interop.EthereumClient
{
public class EthereumClientBase : IEthereumClientBase
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add xmldoc for methods in the class (and also for other methods in this PR that are not documented)

return result;
}

public Dictionary<string, string> InvokeContract(InteropRequest request)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some of the methods in this class are not used, some return empty values. Those probably should be implemented or removed


public class MultisigWalletDeployment : ContractDeploymentMessage
{
public static string BYTECODE =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use resources instead of hardcoding it here


namespace Stratis.Bitcoin.Features.Interop
{
public interface IInteropTransactionManager
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add xml doc here and everywhere where it's absent

.FeatureServices(services => services
.AddSingleton<InteropSettings>()
.AddSingleton<IEthereumClientBase, EthereumClientBase>()
//.AddSingleton<IInteropRequestRepository, InteropRequestRepository>()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uncomment or remove

private const string LastScannedHeightKey = "InteropLastScannedHeight";
private const int InteropBatchSize = 100;

private const string ContractAddressKeyPrefix = "CN";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those constants are not used


namespace Stratis.Bitcoin.Features.Interop
{
public class InteropPoller : IDisposable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's an important class, please add documentation

Processed
}

public class ConversionRequest : IBitcoinSerializable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to at least add a high level summary on what these new classes do and/or are used for?


try
{
this.CheckEthereumNode();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably better to do it once on initialization

Guard.NotNull(interopTransactionManager, nameof(interopTransactionManager));
Guard.NotNull(ethereumClientBase, nameof(ethereumClientBase));

this.logger = loggerFactory.CreateLogger(this.GetType().FullName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be cool if we can implement new code with NLog's LogManager.GetCurrentClassLogger(). Not essential here, perhaps in another PR.


namespace Stratis.Bitcoin.Features.FederatedPeg
{
public interface IConversionRequestRepository
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps comment these methods?

this.logger = Substitute.For<ILogger>();
this.loggerFactory.CreateLogger(null).ReturnsForAnyArgs(this.logger);
this.httpClientFactory = new HttpClientFactory();
this.httpClientFactory = new Bitcoin.Controllers.HttpClientFactory();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm why this namespace add?


namespace Stratis.Bitcoin.Features.Interop.Models
{
public class EthereumRequestModel
Copy link
Contributor

@fassadlr fassadlr Mar 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if JsonProperty attributes should be added here?

}
}

public void RemoveTransaction(string requestId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does transaction's get removed?


public override Task InitializeAsync()
{
this.interopPoller?.Initialize();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we guarantee that this is called after the federation feature has initialized? As we rely on things like "IsFederationMember" etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, the interoperability feature should initialize well after the federation manager, is it necessary to explicitly check that it has completed before using IsFederationMember?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ok. We just need to ensure that initialization sequence is correct

}
catch (Exception e)
{
this.logger.LogWarning("Exception raised when checking interop requests. {0}", 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exception is not logged

return requests;
}

private void ProcessEthereumRequests()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a lot of unused code above and blow this point

Copy link
Contributor

@noescape00 noescape00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also please implement TODOs

this.ethereumClientBase = ethereumClientBase;
}

[NoTrace]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fody was removed from codebase according to @fassadlr , so this tag is not needed


return;
}
else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else and {} are not needed

{
public enum InteropRequestType
{
// Stratis (Cirrus) network invoking Ethereum contract.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convert to xmldoc

/// <summary>
/// For either type of invocation, this is the name of the method that is to be invoked.
/// </summary>
public string MethodName { get { return this.methodName; } set { this.methodName = value; } }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not used anywhere


public bool Enabled { get; set; }

public string InteropContractCirrusAddress { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please comment all properties

@noescape00 noescape00 closed this Mar 24, 2021
@noescape00
Copy link
Contributor

Updated version is here: #481

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants