test: add backward compat toml test (#4531)

This commit is contained in:
Matthias Seitz
2023-09-08 15:48:14 +02:00
committed by GitHub
parent d1f8c6ec01
commit 0fed70773c
5 changed files with 104 additions and 4 deletions

View File

@ -23,6 +23,9 @@ serde_json.workspace = true
# crypto
secp256k1 = { workspace = true, features = ["global-context", "rand-std", "recovery"] }
confy = "0.5"
# misc
confy.workspace = true
tempfile = "3.4"
tempfile = "3.4"
[dev-dependencies]
toml.workspace = true

View File

@ -327,4 +327,96 @@ mod tests {
assert_eq!(config, loaded_config);
})
}
// ensures config deserialization is backwards compatible
#[test]
fn test_backwards_compatibility() {
let alpha_0_0_8 = r"#[stages.headers]
downloader_max_concurrent_requests = 100
downloader_min_concurrent_requests = 5
downloader_max_buffered_responses = 100
downloader_request_limit = 1000
commit_threshold = 10000
[stages.total_difficulty]
commit_threshold = 100000
[stages.bodies]
downloader_request_limit = 200
downloader_stream_batch_size = 1000
downloader_max_buffered_blocks_size_bytes = 2147483648
downloader_min_concurrent_requests = 5
downloader_max_concurrent_requests = 100
[stages.sender_recovery]
commit_threshold = 5000000
[stages.execution]
max_blocks = 500000
max_changes = 5000000
[stages.account_hashing]
clean_threshold = 500000
commit_threshold = 100000
[stages.storage_hashing]
clean_threshold = 500000
commit_threshold = 100000
[stages.merkle]
clean_threshold = 50000
[stages.transaction_lookup]
commit_threshold = 5000000
[stages.index_account_history]
commit_threshold = 100000
[stages.index_storage_history]
commit_threshold = 100000
[peers]
refill_slots_interval = '1s'
trusted_nodes = []
connect_trusted_nodes_only = false
max_backoff_count = 5
ban_duration = '12h'
[peers.connection_info]
max_outbound = 100
max_inbound = 30
[peers.reputation_weights]
bad_message = -16384
bad_block = -16384
bad_transactions = -16384
already_seen_transactions = 0
timeout = -4096
bad_protocol = -2147483648
failed_to_connect = -25600
dropped = -4096
[peers.backoff_durations]
low = '30s'
medium = '3m'
high = '15m'
max = '1h'
[sessions]
session_command_buffer = 32
session_event_buffer = 260
[sessions.limits]
[sessions.initial_internal_request_timeout]
secs = 20
nanos = 0
[sessions.protocol_breach_request_timeout]
secs = 120
nanos = 0
#";
let _conf: Config = toml::from_str(alpha_0_0_8).unwrap();
}
}