-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(code/starknet): Starknet interoperability #868
base: main
Are you sure you want to change the base?
Conversation
Setup and runStart one starknet (bootstrap) node and one Malachite node:
Current state
cc @romac |
Looks like they use Ed25519 and not ECDSA: https://github.com/starkware-libs/sequencer/blob/875926b20f629c6e05e1dfbf69bf81cdc8044dee/crates/papyrus_network/src/network_manager/mod.rs#L685-L690 |
I can do the switch to Ed25519, but will keep the ECDSA implementation around in case we ever need to switch back to it. |
❌ 15 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
By making sure to a) use the LAN address for the sequencer multiaddr in our I got Malachite to the sequencer a few times but it always gets disconnected right away:
On the sequencer side:
Moreover, this is very finicky and I have not managed to get them to connect this way since… |
When this works, in the peer manager, But Looking at the logs, there should be a pending outbound session with id 0:
Forcing a call to
I wonder if we need to through the Starknet discovery protocol to make sure that the sequencer's peer manager expects us to connect? |
iirc, shahak mentioned that we need to run at minimum the identity protocol |
Yes I noticed and changed the identify protocol version accordingly to match Starknet's but that did not help. |
Update: With the latest changes, the two engines can now connect to each other, provided that Malachite discovery is disabled in the config. See an example config below. Here is the sequencer processing our vote and ignoring it because we are not in the validator set:
The sequencer now sees the vote sent by Malachite, but Malachite does not see votes or proposals broadcasted by the sequencer. Next steps:
Show Malachite configmoniker = "test-1"
[logging]
log_level = "debug"
log_format = "plaintext"
[consensus]
value_payload = "parts-only"
timeout_propose = "10s"
timeout_propose_delta = "500ms"
timeout_prevote = "5s"
timeout_prevote_delta = "500ms"
timeout_precommit = "5s"
timeout_precommit_delta = "500ms"
timeout_commit = "0s"
timeout_step = "300s"
[consensus.p2p]
listen_addr = "/ip4/127.0.0.1/tcp/27001"
persistent_peers = ["/ip4/127.0.0.1/tcp/27000/p2p/12D3KooWPqT2nMDSiXUSx5D7fasaxhxKigVhcqfkKqrLghCq9jxz"]
# persistent_peers = []
transport = "tcp"
pubsub_max_size = "4.2 MB"
rpc_max_size = "10.5 MB"
[consensus.p2p.discovery]
enabled = false
bootstrap_protocol = "kademlia"
selector = "random"
num_outbound_peers = 1
num_inbound_peers = 1
ephemeral_connection_timeout = "5s"
connect_request_max_retries = 10000
[consensus.p2p.protocol]
type = "gossipsub"
mesh_n = 6
mesh_n_high = 12
mesh_n_low = 4
mesh_outbound_min = 2
[consensus.vote_sync]
mode = "rebroadcast"
[mempool]
max_tx_count = 10000
gossip_batch_size = 0
[mempool.p2p]
listen_addr = "/ip4/127.0.0.1/tcp/28001"
persistent_peers = []
transport = "tcp"
pubsub_max_size = "4.2 MB"
rpc_max_size = "10.5 MB"
[mempool.p2p.discovery]
enabled = false
bootstrap_protocol = "full"
selector = "random"
num_outbound_peers = 20
num_inbound_peers = 20
ephemeral_connection_timeout = "5s"
[mempool.p2p.protocol]
type = "gossipsub"
mesh_n = 6
mesh_n_high = 12
mesh_n_low = 4
mesh_outbound_min = 2
[value_sync]
enabled = true
status_update_interval = "10s"
request_timeout = "10s"
[metrics]
enabled = true
listen_addr = "127.0.0.1:29001"
[runtime]
flavor = "single_threaded"
[test]
max_block_size = "1048.6 KB"
tx_size = "1.0 KB"
txs_per_part = 256
time_allowance_factor = 0.5
exec_time_per_tx = "1ms"
max_retain_blocks = 1000
[test.vote_extensions]
enabled = false
size = "0 B" |
- Use `starknet_api`'s `ContractAddress` type for addresses - Propose empty blocks - Fix `BlockInfo` proposal part to match the sequencer's version - Add validator address in genesis and private key file
The two nodes are now able to take turns proposing (empty) blocks and can decide on them. For this to work, pull the latest changes from this branch, and use the following config.tomlmoniker = "test-1"
[logging]
log_level = "debug"
log_format = "plaintext"
[consensus]
value_payload = "parts-only"
timeout_propose = "10s"
timeout_propose_delta = "500ms"
timeout_prevote = "5s"
timeout_prevote_delta = "500ms"
timeout_precommit = "5s"
timeout_precommit_delta = "500ms"
timeout_commit = "0s"
timeout_step = "300s"
[consensus.p2p]
listen_addr = "/ip4/127.0.0.1/tcp/27001"
persistent_peers = ["/ip4/127.0.0.1/tcp/27000/p2p/12D3KooWPqT2nMDSiXUSx5D7fasaxhxKigVhcqfkKqrLghCq9jxz"]
transport = "tcp"
pubsub_max_size = "4.2 MB"
rpc_max_size = "10.5 MB"
[consensus.p2p.discovery]
enabled = false
bootstrap_protocol = "kademlia"
selector = "random"
num_outbound_peers = 1
num_inbound_peers = 1
ephemeral_connection_timeout = "5s"
connect_request_max_retries = 10000
[consensus.p2p.protocol]
type = "gossipsub"
mesh_n = 6
mesh_n_high = 12
mesh_n_low = 4
mesh_outbound_min = 2
[consensus.vote_sync]
mode = "rebroadcast"
[mempool]
max_tx_count = 10000
gossip_batch_size = 0
[mempool.p2p]
listen_addr = "/ip4/127.0.0.1/tcp/28001"
persistent_peers = []
transport = "tcp"
pubsub_max_size = "4.2 MB"
rpc_max_size = "10.5 MB"
[mempool.p2p.discovery]
enabled = false
bootstrap_protocol = "full"
selector = "random"
num_outbound_peers = 20
num_inbound_peers = 20
ephemeral_connection_timeout = "5s"
[mempool.p2p.protocol]
type = "gossipsub"
mesh_n = 6
mesh_n_high = 12
mesh_n_low = 4
mesh_outbound_min = 2
[value_sync]
enabled = false
status_update_interval = "10s"
request_timeout = "10s"
[metrics]
enabled = true
listen_addr = "127.0.0.1:29001"
[runtime]
flavor = "single_threaded"
[test]
max_block_size = "1048.6 KB"
tx_size = "1.0 KB"
txs_per_part = 256
time_allowance_factor = 0.5
exec_time_per_tx = "1ms"
max_retain_blocks = 1000
[test.vote_extensions]
enabled = false
size = "0 B"
genesis.json{
"validator_set": {
"validators": [
{
"address": "0x0000000000000000000000000000000000000000000000000000000000000065",
"public_key": {
"type": "tendermint/PubKeyEd25519",
"value": "Hhaz5Ebr1Yx1VKNOVBnbazs5B5IyWN8P0qxkmE2oIn8="
},
"voting_power": 1
},
{
"address": "0x0000000000000000000000000000000000000000000000000000000000000064",
"public_key": {
"type": "tendermint/PubKeyEd25519",
"value": "xZpDiwDi7+uP/4Goz1QChct3qvDZ+IyHr89EqZIgrk0="
},
"voting_power": 1
}
]
}
} priv_validator_key.json{
"private_key": {
"type": "tendermint/PrivKeyEd25519",
"value": "z1exB2b1hS8Ajtr/Qf/PvjD0ES/m7RoEwzaT69t2+Ow="
},
"public_key": {
"type": "tendermint/PubKeyEd25519",
"value": "Hhaz5Ebr1Yx1VKNOVBnbazs5B5IyWN8P0qxkmE2oIn8="
},
"address": "0x0000000000000000000000000000000000000000000000000000000000000065"
} Then, reset the state and start Malachite with
Once Malachite starts trying to connect to the sequencer, reset the sequencer state and start the sequencer with:
The two nodes will start taking turns proposing empty blocks and decide them. After killing the two processes, if one does not clear the state of each node, the nodes are able to restart, pick up where they left off, and produce blocks again :) |
tx_part.send(part).await?; | ||
sequence += 1; | ||
} | ||
// let max_block_size = params.max_block_size.as_u64() as usize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If max_block_size is set to 0, this should yield empty blocks without reaping any txes from the mempool.
// } | ||
// } | ||
|
||
// // Proposal Commitment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can stay commented out until the sequencer updates to the latest protos
Closes: #XXX
Temporary PR for progress on interop with Starknet
PR author checklist
For all contributors
For external contributors