示例#1
0
 public ResultWrapper <Keccak> eth_sendTransaction(TransactionForRpc transactionForRpc)
 {
     throw new NotSupportedException();
 }
示例#2
0
 public ResultWrapper <UInt256?> eth_estimateGas(TransactionForRpc transactionCall, BlockParameter blockParameter) =>
 new EstimateGasTxExecutor(_blockchainBridge, _blockFinder, _rpcConfig)
 .ExecuteTx(transactionCall, blockParameter);
示例#3
0
 public ResultWrapper <AccessListForRpc> eth_createAccessList(TransactionForRpc transactionCall, BlockParameter?blockParameter = null, bool optimize = true) =>
 new CreateAccessListTxExecutor(_blockchainBridge, _blockFinder, _rpcConfig, optimize)
 .ExecuteTx(transactionCall, blockParameter);
示例#4
0
 public ResultWrapper <ParityLikeTxTrace> trace_call(TransactionForRpc message, string[] traceTypes, BlockParameter quantity)
 {
     throw new NotImplementedException();
 }
示例#5
0
 public ResultWrapper <string> eth_call(TransactionForRpc transactionCall, BlockParameter?blockParameter = null) =>
 new CallTxExecutor(_blockchainBridge, _blockFinder, _rpcConfig)
 .ExecuteTx(transactionCall, blockParameter);
示例#6
0
        public ResultWrapper <ParityTxTraceFromReplay> trace_call(TransactionForRpc message, string[] traceTypes, BlockParameter blockParameter)
        {
            Transaction tx = message.ToTransaction();

            return(TraceTx(tx, traceTypes, blockParameter));
        }
示例#7
0
        private void TestCallWithStorageAndCode(byte[] code, UInt256 gasPrice, Address from = null)
        {
            StateProvider   stateProvider   = CreateInitialState(code);
            StorageProvider storageProvider = new StorageProvider(new TrieStore(_dbProvider.StateDb, LimboLogs.Instance), stateProvider, LimboLogs.Instance);

            for (int i = 0; i < 10000; i++)
            {
                storageProvider.Set(new StorageCell(TestItem.AddressB, (UInt256)i), i.ToBigEndianByteArray());
            }

            storageProvider.Commit();
            storageProvider.CommitTrees(0);

            stateProvider.Commit(MainnetSpecProvider.Instance.GenesisSpec, null);
            stateProvider.CommitTree(0);

            Keccak root = stateProvider.StateRoot;

            Block block = Build.A.Block.WithParent(_blockTree.Head).WithStateRoot(root).TestObject;

            BlockTreeBuilder.AddBlock(_blockTree, block);
            Block blockOnTop = Build.A.Block.WithParent(block).WithStateRoot(root).TestObject;

            BlockTreeBuilder.AddBlock(_blockTree, blockOnTop);

            // would need to setup state root somehow...

            TransactionForRpc tx = new TransactionForRpc
            {
                // we are testing system transaction here when From is null
                From     = from,
                To       = TestItem.AddressB,
                GasPrice = gasPrice,
                Nonce    = 1000
            };

            CallResultWithProof callResultWithProof = _proofModule.proof_call(tx, new BlockParameter(blockOnTop.Number)).Data;

            Assert.Greater(callResultWithProof.Accounts.Length, 0);

            // just the keys for debugging
            Span <byte> span = stackalloc byte[32];

            new UInt256(0).ToBigEndian(span);
            Keccak k0 = Keccak.Compute(span);

            // just the keys for debugging
            new UInt256(1).ToBigEndian(span);
            Keccak k1 = Keccak.Compute(span);

            // just the keys for debugging
            new UInt256(2).ToBigEndian(span);
            Keccak k2 = Keccak.Compute(span);

            foreach (AccountProof accountProof in callResultWithProof.Accounts)
            {
                // this is here for diagnostics - so you can read what happens in the test
                // generally the account here should be consistent with the values inside the proof
                // the exception will be thrown if the account did not exist before the call
                Account account;
                try
                {
                    account = new AccountDecoder().Decode(new RlpStream(ProofVerifier.Verify(accountProof.Proof, block.StateRoot)));
                }
                catch (Exception)
                {
                    // ignored
                }

                foreach (StorageProof storageProof in accountProof.StorageProofs)
                {
                    // we read the values here just to allow easier debugging so you can confirm that the value is same as the one in the proof and in the trie
                    byte[] value = ProofVerifier.Verify(storageProof.Proof, accountProof.StorageRoot);
                }
            }

            EthereumJsonSerializer serializer = new EthereumJsonSerializer();
            string response = RpcTest.TestSerializedRequest(_proofModule, "proof_call", $"{serializer.Serialize(tx)}", $"{blockOnTop.Number}");

            Assert.True(response.Contains("\"result\""));
        }
示例#8
0
 public ResultWrapper <Keccak> personal_sendTransaction(TransactionForRpc transaction, string passphrase)
 {
     throw new NotImplementedException();
 }
示例#9
0
        public Task <ResultWrapper <Keccak> > eth_sendTransaction(TransactionForRpc transactionForRpc)
        {
            Transaction tx = transactionForRpc.ToTransactionWithDefaults();

            return(SendTx(tx));
        }
示例#10
0
 public ResultWrapper <AccessListForRpc> eth_createAccessList(TransactionForRpc transactionCall, BlockParameter?blockParameter = null, bool optimize = true)
 {
     throw new NotSupportedException();
 }
示例#11
0
 public ResultWrapper <UInt256?> eth_estimateGas(
     TransactionForRpc transactionCall,
     BlockParameter?blockParameter = null)
 {
     throw new NotSupportedException();
 }
示例#12
0
 public ResultWrapper <string> eth_call(TransactionForRpc transactionCall, BlockParameter?blockParameter = null)
 {
     throw new NotSupportedException();
 }
示例#13
0
 public UInt256?eth_estimateGas(TransactionForRpc transactionCall)
 {
     throw new NotImplementedException();
 }
示例#14
0
 public ResultWrapper <byte[]> eth_call(TransactionForRpc transactionCall, BlockParameter blockParameter = null)
 {
     throw new NotImplementedException();
 }