Commit Graph

25 Commits

Author SHA1 Message Date
Mark Holt
751f62615d
Devnet sync events (#7911)
This request implements an end to end Polygon state sync in the devnet.

It does this by deploying smart contracts ont the L2 & L2 chain which
follow the polygon fx portal model with security checks removed to
simplify the code. The sync events generated are routed through a local
mock heimdal - to avoid the consensus process for testing purposes.

The commit also includes support code to help the delivery of additional
contract based scenratios.
2023-07-20 23:10:18 +01:00
Mark Holt
529d359ca6
Bor span testing (#7897)
An update to the devnet to introduce a local heimdall to facilitate
multiple validators without the need for an external process, and hence
validator registration/staking etc.

In this initial release only span generation is supported.  

It has the following changes:

* Introduction of a local grpc heimdall interface
* Allocation of accounts via a devnet account generator ()
* Introduction on 'Services' for the network config

"--chain bor-devnet --bor.localheimdall" will run a 2 validator network
with a local service
"--chain bor-devnet --bor.withoutheimdall" will sun a single validator
with no heimdall service as before

---------

Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-07-18 09:47:04 +01:00
ledgerwatch
0a1229bd76
Fixed for the devnet runner (#7808)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-06-28 18:21:27 +01:00
Mark Holt
bcc2a4a2f8
Cleaned up error handling in network and node start-up (#7811)
The check in catches errors in the node start-up code and makes sure
that the network is stopped if any node fails to start cleanly, and
that5 it returns an error - so that any calling code can take
appropriate action.
2023-06-28 18:21:15 +01:00
Mark Holt
f110102023
Devnet scenarios (#7723)
This is an update to the devnet code which introduces the concept of
configurable scenarios. This replaces the previous hard coded execution
function.

The intention is that now both the network and the operations to run on
the network can be described in a data structure which is configurable
and composable.

The operating model is to create a network and then ask it to run
scenarios:

```go
network.Run(
		runCtx,
		scenarios.Scenario{
			Name: "all",
			Steps: []*scenarios.Step{
				&scenarios.Step{Text: "InitSubscriptions", Args: []any{[]requests.SubMethod{requests.Methods.ETHNewHeads}}},
				&scenarios.Step{Text: "PingErigonRpc"},
				&scenarios.Step{Text: "CheckTxPoolContent", Args: []any{0, 0, 0}},
				&scenarios.Step{Text: "SendTxWithDynamicFee", Args: []any{recipientAddress, services.DevAddress, sendValue}},
				&scenarios.Step{Text: "AwaitBlocks", Args: []any{2 * time.Second}},
			},
		})
```
The steps here refer to step handlers which can be defined as follows:

```go
func init() {
	scenarios.MustRegisterStepHandlers(
		scenarios.StepHandler(GetBalance),
	)
}

func GetBalance(ctx context.Context, addr string, blockNum requests.BlockNumber, checkBal uint64) {
...
```
This commit is an initial implementation of the scenario running - which
is working, but will need to be enhanced to make it more usable &
developable.

The current version of the code is working and has been tested with the
dev network, and bor withoutheimdall. There is a multi miner bor
heimdall configuration but this is yet to be tested.

Note that by default the scenario runner picks nodes at random on the
network to send transactions to. this causes the dev network to run very
slowly as it seems to take a long time to include transactions where the
nonce is incremented across nodes. It seems to take a long time for the
nonce to catch up in the transaction pool processing. This is yet to be
investigated.
2023-06-14 12:35:22 +01:00
Mark Holt
415cf86250
refactor to allow switchable consensus and multiple communicating nodes (#7646)
This branch is intended to allow the devnet to be used for testing
multiple consents types beyond the default clique. It is initially being
used to test Bor consensus for polygon.

It also has the following refactoring:

### 1.  Network configuration

The two node arg building functions miningNodeArgs and nonMiningNodeArgs
have been replaced with a configuration struct which is used to
configure:

```go
network := &node.Network{
		DataDir: dataDir,
		Chain:   networkname.DevChainName,
		//Chain:              networkname.BorDevnetChainName,
		Logger:             logger,
		BasePrivateApiAddr: "localhost:9090",
		BaseRPCAddr:        "localhost:8545",
		Nodes: []node.NetworkNode{
			&node.Miner{},
			&node.NonMiner{},
		},
	}
```
and start multiple nodes

```go
network.Start()
```
Network start will create a network of nodes ensuring that all nodes are
configured with non clashing network ports set via command line
arguments on start-up.

### 2. Request Routing

The `RequestRouter` has been updated to take a 'target' rather than
using a static dispatcher which routes to a single node on the network.
Each node in the network has its own request generator so command and
services have more flexibility in request routing and
`ExecuteAllMethods` currently takes the `node.Network` as an argument
and can pick which node (node 0 for the moment) to send requests to.
2023-06-04 20:53:05 +01:00
ledgerwatch
d66f9ce51f
[devnet] fix logging (#7611)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-31 20:29:36 +01:00
ledgerwatch
f5bd806b84
[devnet] Remove dependency on rpctest (#7608)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-31 19:47:32 +01:00
ledgerwatch
cb04c203d8
[devnet] log devnet tool output into a file (#7557)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-21 15:33:11 +01:00
ledgerwatch
90cb6be425
[devnet tool] fixing port conflicts (#7520)
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2023-05-15 20:31:35 +01:00
ledgerwatch
5d6b0ead8f
[devnet tool] separate logging (#7510)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2023-05-15 15:30:56 +01:00
Andrew Ashikhmin
02f6cac7b7
Move hexutil.Bytes to erigon-lib (#7305) 2023-04-13 11:19:02 +00:00
Alex Sharov
d4e25daf22
etl: distinct empty values from nil (#7039)
Reverts ledgerwatch/erigon#7038
2023-03-07 04:19:00 +00:00
Alex Sharov
7206e482da
Revert "etl: distinct empty values from nil" (#7038)
Reverts ledgerwatch/erigon#6934
2023-03-07 03:22:23 +00:00
Alex Sharov
c5acfd0503
etl: distinct empty values from nil (#6934) 2023-03-07 02:33:21 +00:00
Jochen Müller
da369fedac
Fix test in devnet tool (#7019)
- invalid gas price range with max < min
- nonce bumped for transactions that will not be mined
2023-03-03 16:20:45 +00:00
Leonard Chinonso
599fc24aed
Devnet Test for EIP1559 (#6938)
**Current Problem**

When X transactions are created, with M transactions out of them having
`gasFeeCap` greater than the current `baseFeePerGas` for the block, and
N transactions having `gasFeeCap` lower, all X transactions get added to
the yellow pool (baseFee) in the txpool and they never get mined.
However when X transactions all having `gasFeeCap` higher than the
`baseFeePerGas` are created, they all get added to the green pool
(pending) in the txpool and thus get mined.

This phenomenon can be inspected in the
`signEIP1559TxsLowerAndHigherThanBaseFee2` function where the number of
transactions that should have `gasFeeCap` higher than and lower than the
current `baseFeePerGas` is specified in its parameter - `func
signEIP1559TxsLowerAndHigherThanBaseFee2(amountLower, amountHigher
int...`.
When `amountLower` is set as `0`, all transactions created from
`amountHigher` will be mined because they have `gasFeeCap` >
`baseFeePerGas`. When `amountLower` has a value > `0`, all the
transactions created (including transactions created with
`amountHigher`) will go to the yellow pool (baseFee) and thus do not get
mined.
2023-03-02 10:25:11 +00:00
hexoscott
7dcbfbc283
reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
Alex Sharov
41e9356f61
e3: stream.ToBitamp() (#6562) 2023-01-12 09:58:21 +07:00
Leonard Chinonso
310b8d9e01
Reorganization the devnet subscription services (#6331) 2023-01-10 17:43:58 +00:00
Leonard Chinonso
805230ba63
Setup web socket endpoints to listen for new transactions after sending (#5940)
- Added listening methods for WebSocket subscriptions 
- Listened for new blocks using the newHeads method to determine when to
look for a transaction
- Added new util methods and tests for them
- Simplified communication to the user upon initiating the devnet tool
2022-11-03 09:45:36 +07:00
Leonard Chinonso
3163f40e58
Added Mechanism For Sending Raw Transaction (#5825)
- Added new requests for sending raw transactions
- Made provisions for other types of transactions generated, including
contracts
- Modified the models and services to accommodate general values
2022-10-31 17:46:49 +07:00
Leonard Chinonso
bb780a06d3
Tested functionalities for request_generator (#5905)
- Added tests for request_generator in devnet
- Added tests for request_generator in rpctests
2022-10-30 19:54:09 +07:00
Leonard Chinonso
726ed8462d
Setup calls for rpc testing (#5661)
Setup calls for rpc testing
- Added call requests for testing rpc calls
- Added new methods getBalance and txPool content
2022-10-11 13:34:32 +01:00
Leonard Chinonso
b405dfdff7
Added separate logging to devnet nodes (#5618)
Added separate logging to devnet nodes
- Created two log files for the mining and non-mining nodes
- Piped log outputs to the two separate log files
2022-10-06 20:06:03 +01:00