Pack Process
Startup Variables:
epoch length = 30
initial eth number = 100 or 100|0000 (block-tx number)
$sc_scan = []
max throughput = 50
from network = eth
to network = Solis
All new 11 signers will start the download task in block#31, they first look for opposite $sc_scan value in order to decide own scan range to scan. By now, $sc_scan is empty, therefore signers know that scan range will be 100|0000 (initial eth number) to 199|9999 (closest eth block match to local block#30's utc time). At the end, 4 packs will be created accordingly.
pack#1, scan range: 100|0000, 115|1234, carry 50 bridge txs.
pack#2, scan range: 115|1235, 123|0342, carry 50 bridge txs.
pack#3, scan range: 123|0343, 144|0010, carry 50 bridge txs.
pack#4, scan range: 144|0011, 194|0111, carry 50 bridge txs.
look, even if end scan range is 199|9999, but it will stop at 194|0111 as soon as it reaches 50 bridge txs.
by now, relayer has to carry his work to deliver all these 4 packs, due to nature of blockchain, these 4 packs won't arrive sc in order,say pack arrive in this order: 4,2,3,1
pack#4 arrived, bridge contract will update $sc_scan = [144|0011, 194|0111] right after finish cross transfer.
pack#2 arrived, $sc_scan = [115|1235, 123|0342, 144|0011, 194|0111]
pack#3 arrived, $sc_scan = [115|1235, 194|0111]
pack#1 arrived, $sc_scan = [100|0000, 194|0111]
Bridge contract plays its role in:
receive pack, validate validness of scan range (pack header), validate 11 signatures are really mean for this pack and signed by 11 different signers.
transfer/mint token to their target recipient.
update $sc_scan (fill the gap if any).
new signers query $sc_scan with return value is [100|0000, 194|0111], signer know that they need to scan range from 194|0112 to 299|9999 for this round and 3 packs will be created accordingly.
pack#1, scan range: 194|0112,215|0334, carry 50 bridge txs.
pack#2, scan range: 215|0335,244|0001, carry 50 bridge txs.
pack#3, scan range: 244|0002,299|9999, carry 30 bridge txs.
by now, relayer will send each pack accordingly. but one thing, pack#3 encounter out-of-gas error!
pack#3 arrived & encounter out-of-gas error, $sc_scan = [100|0000, 194|0111] (remain same)
pack#2 arrived , $sc_scan = [100|0000, 194|0111, 215|0335, 244|0001]
pack#1 arrived, $sc_scan = [100|000, 244|0001]
interesting thing here is, pack#3 will be repack and resend in future entirely.
new signers query $sc_scan with return value is [100|000,244|0001], this time signers will scan range from 244|0002 to 399|9999. Interestingly, only 1 pack will be created accordingly.
pack#1, scan range: 244|0002,378|0123, carry 50 bridge txs
by now, relayer send this pack.
pack#1 arrived, $sc_scan = [100|0000,378|0123]
Last updated