Fixes race condition between attaching the NodeAddedListener and some state from post marked block being persisted. We now prepare and cleanup the listener only once each, on start and stop respectively.
Other changes:
Start the Pruner before FullSyncDownloader. Luckily the downloader took enough time to start downloading that this wasn't an issue but it's safer this way.
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Add a new CLI flag `--required-block` that takes a block number and a
block hash. Before using a peer for syncing we validate that the block
exists with the spcified hash at the peer.
For example `--required-block=6485846=0x43f0cd1e5b1f9c4d5cda26c240b59ee4f1b510d0a185aa8fd476d091b0097a80`
deals with the current Istanbul Ropsten chainsplit.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
We should not send a sync status for every forking block state update.
Yes, we send status updates for detected forks as well as new canonical
heads.
Instead we should send a synching message for status changes as well as
when we reorg the chain.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* [PAN-3023] Add command line option for target gas limit
Signed-off-by: cfelde <cfelde@cfelde.com>
* [PAN-3023] Add command line option for target gas limit
Signed-off-by: Christian Felde <cfelde@cfelde.com>
* [PAN-3023] Add command line option for target gas limit
Signed-off-by: Christian Felde <cfelde@cfelde.com>
* [PAN-3023] Add command line option for target gas limit
Signed-off-by: Christian Felde <cfelde@cfelde.com>
[PIE-1858] Added functionality to register custom metrics categories and exposed some PoA data for metrics.
Signed-off-by: Mark Terry <mark.terry@consensys.net>
Adds integration tests to catch bug where the mark storage was being cleared before a mark began. Instead, the mark storage is now cleared upon preparing the mark sweep pruner
Fixes bug where the pending marks where not being checked while pruning was occurring. By removing the flush in sweepBefore, the existing tests catch the bug.
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* Update version to 1.2.5-SNAPSHOT (#42)
Signed-off-by: Edward Evans <edward.joshua.evans@gmail.com>
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* introduce `VirtualOperation`
- add `isVirtualOperation` method to `Operation` interface: determines whether or not the operation has been virtually added to the contract code.
- default implementation of `isVirtualOperation` returns `false`
- create `VirtualOperation` that wraps a real `Operation` and returns `true` for `isVirtualOperation` method.
- change `constructor` of `EVM` to pass a `GasCalculator` used to create the `endOfScriptStop` and `invalidOperation` fields.
- change visibility of `EVM.operationAtOffset` to `package` for testing purpose. (add `VisibleForTesting` annotation)
- create `EVMTest` to test `operationAtOffset` method .
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* adding in spdx-license-identifier & updated check for the same; removing license check from spotless
Signed-off-by: Joshua Fernandes <joshua.fernandes@consensys.net>
* Change CheckSpdxHeader to a task.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Expose EthPeer validation state so that the Synchronizer can choose peers based on whether or not they have been fully validated. This allows us to use only fully validated peers when choosing a pivot block.
Signed-off-by: Meredith Baxter <meredith.baxter@consensys.net>
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Update discovery logic to consider a peer with an unknown discovery endpoint to be unknown regardless of whether we've encountered a peer with the same node id before. This makes the discovery logic more forgiving in the face of node restarts.
If nodeA bonds with nodeB, then nodeB leaves the network and later comes back with a different ip address or listening port, nodeA would previously continue trying to communicate with nodeB at its original address. With these changes, nodeA will now treat the restarted nodeB as a new peer and communicate with it on its updated endpoint. Additionally, nodeB's information will be updated in the peer table so that neighbors requests return updated information on this node.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Remove metrics from plugin registration. Doing it this way here always results in a
NoOpsMetrics being inited because CLI options have not been parsed.
Add an acceptance test for metrics. This is what should have been in place and
would have detected metrics not working earlier.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Factorise metrics code for KeyValueStorage database
- introduce `MonitorableKeyValueStorage`
- factorise code
- remove metrics instanciation in `RocksDbKeyValueStorage` and `ColumnarRocksDbKeyValueStorage`
* Rename class
* [PAN-2995] Make account.getAddress() return an Optional<Address>
* fix Jenkins failure
* fix failing test
* fix failing test
* Revert "fix failing test"
This reverts commit e2bb261a185d20f75e33be0ec72f5b5851c40461.
* Revert "fix failing test"
This reverts commit e5dc3fa073ef968bc017e513d15657204f54e519.
* Revert "fix Jenkins failure"
This reverts commit 15f90ea5e214ac624b891225bd096466c2ce1111.
* Revert "[PAN-2995] Make account.getAddress() return an Optional<Address>"
This reverts commit 08cc7ca5b785c666acd8d2b34d5f672837cd78fe.
* init trace_replayBlockTransactions
* Revert "init trace_replayBlockTransactions"
This reverts commit 545426595c8ede0b30ab1025bbdd262ce51281b7.
* Revert "Revert "init trace_replayBlockTransactions""
This reverts commit 756f52bb019c0e0c61aac4a97269d40198341c86.
* Update TraceReplayBlockTransactions.java
* Check request parameters
Method returns an error if any option other than “trace” is supplied.
* Update TraceReplayBlockTransactions.java
* implement trace_replayBlockTransactions
- start business logic implementation
- iterate through `TraceFrame` and transform to parity style
- detect `CALL` opcode to retrieve contract address required in parity format
* remove comments
* add final modifier for method parameters
* fix unit tests
* remove useless log
* transform address from stack (Bytes32) to an Address
* trace_replayBlockTransactions new features
- compute gas used for each sub trace
- detect `RETURN` opcode
- to get `ouput` value from `memory`
- detect end of subtrace
* fix unit tests
* Update FlatTrace.java
add final modifier
* pretty format JSON file
* handle smart contract deployments
* handle smart contract deployment
- set `code` field when contract creation transaction
- set `address` field when contract creation transaction
* introduce FlatTraceGenerator
* refactoring
* spotless apply
* update tests to compare Json node tree independently of the order
- added generated test cases
- use jackson `ObjectMapper` to compare the actual result to the expected one
- `assertThat(mapper.readTree(actualResult)).isEqualTo(mapper.readTree(expectedResult));`
* fix unit tests
- return empty result if block is empty
- handle case where there is no `RETURN`, `STOP` is then considered as a return to close the trace and perform gas computation.
- increment gas remaining by gas used
* spotless apply
* introduce SELFDESTRUCT
* set result to null when suicide type
* remove result field, use builder only
* re-enable tracing tests
* implement gas used computation
- implement a strategy with 2 options
- if first frame gas remaining is higher than gas remaining after transaction was processed then the gas used will be the net difference
- otherwise a frame by frame cumulative gas cost will be used
* get self destruct refund balance from message frame
* give access to `ProtocolSchedule` to get `GasCalculator`
* fix gas used computation for subtrace (1 level deep)
* fix input, use all memory and not only first element
* fix trace addresses
* debug log
* remove some tests files
* Revert "remove some tests files"
This reverts commit 88ee6aa84c199e1f386e1ba314c507d17c89226d.
* debug jenkins
* out instead of err
* spotless apply
* add debug info
* remove static modifier for blockchainSetupUtil field
* remove unused field
* add javadoc for gasCalculator parameter
* fix PR review comments
* add javadoc for Trace interface
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Ensure `plugin-api` module gets published at the correct maven path
* Move `plugins` to `plugin-api`
Signed-off-by: Edward Evans <edward.evans@consensys.net>
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Return plugin-api to the main repo
* Spotless
* Migrate all external plugin-api references to the project in this repo
* Add licence header
* Update repo reference for publish, even if commented
* Use real configuration for publishing plugin-api
This was tested with the
`:plugins:publishMavenJavaPublicationToMavenLocal` task and checking the
local Maven repo to make sure it was using the correct paths
Signed-off-by: Edward Evans <edward.evans@consensys.net>
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* update web3j 4.5.0 + use pantheon module in favour of core
* remove custom eea/privacy rpc calls -> use web3j instead
* overhaul the conditions -> web3j does the polling for receipts for us
* re-define a PrivacyNode - it is an object that holds a PantheonNode and an OrionTestHarness
* do not start OrionTestHarness prematurely - calling PrivacyNode.start() will start an Orion node followed by it's accompanying Pantheon node
* stop and close resources properly -> clean-up removes the created temporary directories correctly
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Interally we use a `BigInteger` for ChainID, but currently use an `int` for
NetworkID. Because the default for NetworkID is the same value as ChainID there
are some chains where this will be very problematic, and there is at least
one other long-living chain outside the 32 bit int value range.
This is a large commit because the type is baked fairly deep into some of
the other APIs and very much in the test code testing the type.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>