Skip to content
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

fix: remove Timestamp from epoch inputs #324

Merged
merged 1 commit into from
Dec 18, 2024
Merged

fix: remove Timestamp from epoch inputs #324

merged 1 commit into from
Dec 18, 2024

Conversation

fedellen
Copy link
Contributor

No description provided.

@fedellen fedellen requested a review from a team as a code owner December 18, 2024 21:52
src/common/io.ts Outdated
Comment on lines 169 to 174
{
name: 'Timestamp',
value:
(params as { timestamp?: number })?.timestamp?.toString() ??
(await getCurrentBlockUnixTimestampMs(this.arweave)).toString(),
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have to validate if CUs will set the Timestamp on dry-runs. historically they did not. So I think the best intermittent approach is to set Timestamp: Date.now() tag ONLY if epoch-index is not provided

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after inspection, it looks like CUs set the timestamp based on the last message evaluation they've processed. that should be sufficient for what we need, but will require some more testing. this would allow us to drop the use of TImestamp tags everywhere in the contract.

src/types/io.ts Outdated
Comment on lines 65 to 67
| {
timestamp: Timestamp;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this, we won't allow custom timestamps via the SDK anymore

).toString(),
},
],
tags: [{ name: 'Action', value: 'Epoch' }],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this work on devnet without Date.now()? if so, sweet.

Copy link
Contributor Author

@fedellen fedellen Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes 👍

{"level":"debug","message":"Evaluating read interaction on contract","name":"ar-io-sdk","tags":[{"name":"Action","value":"Epoch"}],"timestamp":"2024-12-18T22:36:42.882Z","version":"3.1.0-alpha.6"}
{"level":"debug","message":"Read interaction result","name":"ar-io-sdk","result":{"Assignments":[],"GasUsed":2131764549,"Messages":[{"Anchor":"00000000000000000000000000003903","Data":"{\"epochIndex\":176,\"startHeight\":1570443,\"distributions\":{\"totalEligibleObserverReward\":162453809,\"totalEligibleRewards\":22743533280,\"rewards\":{\"eligible\":{\"rweM0QUKbLVHADi2jyAvtOYgQv7lhp61NtX2ftXpANY\":{\"delegateRewards\":{\"Rlz7oEBtntc0EXkiK2p_L981kY_MYnp_LG7SUESo5_Q\":1543311186},\"operatorReward\":81226905},\"J40R1BgFSI1_7p25QW49T7P46BePJJnlDrsFGY1YWbM\":{\"delegateRewards\":[],\"operatorReward\":1624538091},\"Rlz7oEBtntc0EXkiK2p_L981kY_MYnp_LG7SUESo5_Q\":{\"delegateRewards\":[],\"operatorReward\":1624538091},\"Rc80LG6h27Y3p9TN6J5hwDeG5M51cu671YwZpU9uAVE\":{\"delegateRewards\":{\"rweM0QUKbLVHADi2jyAvtOYgQv7lhp61NtX2ftXpANY\":1066536594,\"jaxl_dxqJ00gEgQazGASFXVRvO4h-Q0_vnaLtuOUoWU\":476774591},\"operatorReward\":81226905},\"E-QVU3dta36Wia2uQw6tQLjQk7Qw5uN0Z6fUzsoqzUc\":{\"delegateRewards\":{\"rweM0QUKbLVHADi2jyAvtOYgQv7lhp61NtX2ftXpANY\":1543311186},\"operatorReward\":81226905},\"QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ\":{\"delegateRewards\":{\"N4h8M9A9hasa3tF47qQyNvcKjm4APBKuFs7vqUVm-SI\":82443443,\"PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM\":32004145,\"JcC4ZLUY76vmWha5y6RwKsFqYTrMZhbockl8iM9p5lQ\":48006219},\"operatorReward\":1462084282},\"M0WP8KSzCvKpzC-HPF1WcddLgGaL9J4DGi76iMnhrN4\":{\"delegateRewards\":{\"N4h8M9A9hasa3tF47qQyNvcKjm4APBKuFs7vqUVm-SI\":324907618},\"operatorReward\":1299630473},\"iKryOeZQMONi2965nKz528htMMN_sBcjlhc-VncoRjA\":{\"delegateRewards\":[],\"operatorReward\":1624538091},\"q6zIf3KQRMCW9fytR0YlKG4oqw6Cox4r_bk7mq6JZBM\":{\"delegateRewards\":[],\"operatorReward\":1624538091},\"LtV0aSqgK3YI7c5FmfvZd-wG95TJ9sezj_a4syaLMS8\":{\"delegateRewards\":{\"rweM0QUKbLVHADi2jyAvtOYgQv7lhp61NtX2ftXpANY\":1462084281},\"operatorReward\":162453810},\"1H7WZIWhzwTH9FIcnuMqYkTsoyv1OTfGa_amvuYwrgo\":{\"delegateRewards\":[],\"operatorReward\":1624538091},\"jaxl_dxqJ00gEgQazGASFXVRvO4h-Q0_vnaLtuOUoWU\":{\"delegateRewards\":{\"J40R1BgFSI1_7p25QW49T7P46BePJJnlDrsFGY1YWbM\":162453809},\"operatorReward\":1462084282},\"wlcEhTQY_qjDKTvTDZsb53aX8wivbOJZKnhLswdueZw\":{\"delegateRewards\":[],\"operatorReward\":1624538091},\"xN_aVln30LmoCffwmk5_kRkcyQZyZWy1o_TNtM_CTm0\":{\"delegateRewards\":[],\"operatorReward\":1624538091}}},\"totalEligibleGateways\":14,\"totalEligibleGatewayReward\":1462084282},\"endTimestamp\":1734588000000,\"prescribedObservers\":[{\"gatewayRewardRatioWeight\":1,\"tenureWeight\":0.9777777777777777457,\"stakeWeight\":38.724997919400003354,\"compositeWeight\":6.2746790279561146519,\"observerAddress\":\"1H7WZIWhzwTH9FIcnuMqYkTsoyv1OTfGa_amvuYwrgo\",\"gatewayAddress\":\"1H7WZIWhzwTH9FIcnuMqYkTsoyv1OTfGa_amvuYwrgo\",\"startTimestamp\":1719295200000,\"normalizedCompositeWeight\":0.8715690509236552197,\"stake\":387249979194,\"observerRewardRatioWeight\":0.16571428571428570287},{\"gatewayRewardRatioWeight\":1,\"tenureWeight\":0.9777777777777777457,\"stakeWeight\":26.255397969699998839,\"compositeWeight\":0.1466968267513396873,\"observerAddress\":\"QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ\",\"gatewayAddress\":\"QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ\",\"startTimestamp\":1719295200000,\"normalizedCompositeWeight\":0.020376566434000431549,\"stake\":250000000000,\"observerRewardRatioWeight\":0.0057142857142857142808},{\"gatewayRewardRatioWeight\":1,\"tenureWeight\":0.9777777777777777457,\"stakeWeight\":25,\"compositeWeight\":0.13968253968253968589,\"observerAddress\":\"wlcEhTQY_qjDKTvTDZsb53aX8wivbOJZKnhLswdueZw\",\"gatewayAddress\":\"wlcEhTQY_qjDKTvTDZsb53aX8wivbOJZKnhLswdueZw\",\"startTimestamp\":1719295200000,\"normalizedCompositeWeight\":0.019402263924466096878,\"stake\":250000000000,\"observerRewardRatioWeight\":0.0057142857142857142808},{\"gatewayRewardRatioWeight\":0.85795454545454541417,\"tenureWeight\":0.9777777777777777457,\"stakeWeight\":25.736584157599999401,\"compositeWeight\":0.12337219707293968496,\"observerAddress\":\"q6zIf3KQRMCW9fytR0YlKG4oqw6Cox4r_bk7mq6JZBM\",\"gatewayAddress\":\"q6zIf3KQRMCW9fytR0YlKG4oqw6Cox4r_bk7mq6JZBM\",\"startTimestamp\":1719295200000,\"normalizedCompositeWeight\":0.017136715397576867542,\"stake\":257365841576,\"observerRewardRatioWeight\":0.0057142857142857142808},{\"gatewayRewardRatioWeight\":0.85875706214689262463,\"tenureWeight\":0.9777777777777777457,\"stakeWeight\":25.746584157600000964,\"compositeWeight\":0.12283367206387947601,\"observerAddress\":\"M0WP8KSzCvKpzC-HPF1WcddLgGaL9J4DGi76iMnhrN4\",\"gatewayAddress\":\"M0WP8KSzCvKpzC-HPF1WcddLgGaL9J4DGi76iMnhrN4\",\"startTimestamp\":1719295200000,\"normalizedCompositeWeight\":0.017061912889121205739,\"stake\":249326055188,\"observerRewardRatioWeight\":0.0056818181818181819759},{\"gatewayRewardRatioWeight\":0.86931818181818176772,\"tenureWeight\":0.9777777777777777457,\"stakeWeight\":5,\"compositeWeight\":0.097142857142857128028,\"observerAddress\":\"iKryOeZQMONi2965nKz528htMMN_sBcjlhc-VncoRjA\",\"gatewayAddress\":\"iKryOeZQMONi2965nKz528htMMN_sBcjlhc-VncoRjA\",\"startTimestamp\":1719295200000,\"normalizedCompositeWeight\":0.013493392638378693543,\"stake\":50000000000,\"observerRewardRatioWeight\":0.022857142857142857123},{\"gatewayRewardRatioWeight\":0.85795454545454541417,\"tenureWeight\":0.97407515624999996273,\"stakeWeight\":18.890942695100001458,\"compositeWeight\":0.090213665310822685472,\"observerAddress\":\"rweM0QUKbLVHADi2jyAvtOYgQv7lhp61NtX2ftXpANY\",\"gatewayAddress\":\"rweM0QUKbLVHADi2jyAvtOYgQv7lhp61NtX2ftXpANY\",\"startTimestamp\":1719352783170,\"normalizedCompositeWeight\":0.012530910076034559864,\"stake\":182347848195,\"observerRewardRatioWeight\":0.0057142857142857142808},{\"gatewayRewardRatioWeight\":0.93333333333333334814,\"tenureWeight\":0.16462944039351851133,\"stakeWeight\":12.088611636599999599,\"compositeWeight\":0.064050526814143624033,\"observerAddress\":\"E-QVU3dta36Wia2uQw6tQLjQk7Qw5uN0Z6fUzsoqzUc\",\"gatewayAddress\":\"E-QVU3dta36Wia2uQw6tQLjQk7Qw5uN0Z6fUzsoqzUc\",\"startTimestamp\":1731941282943,\"normalizedCompositeWeight\":0.0088967828661583817779,\"stake\":111510748770,\"observerRewardRatioWeight\":0.034482758620689654694},{\"gatewayRewardRatioWeight\":0.93103448275862066286,\"tenureWeight\":0.15769376286008229826,\"stakeWeight\":8.306565332099999921,\"compositeWeight\":0.043555573496148851376,\"observerAddress\":\"jaxl_dxqJ00gEgQazGASFXVRvO4h-Q0_vnaLtuOUoWU\",\"gatewayAddress\":\"jaxl_dxqJ00gEgQazGASFXVRvO4h-Q0_vnaLtuOUoWU\",\"startTimestamp\":1732049146600,\"normalizedCompositeWeight\":0.0060499811520780587618,\"stake\":80172623276,\"observerRewardRatioWeight\":0.035714285714285712303},{\"gatewayRewardRatioWeight\":1,\"tenureWeight\":0.11371482233796295636,\"stakeWeight\":6.0401961938999999546,\"compositeWeight\":0.034342991853788931711,\"observerAddress\":\"Rc80LG6h27Y3p9TN6J5hwDeG5M51cu671YwZpU9uAVE\",\"gatewayAddress\":\"Rc80LG6h27Y3p9TN6J5hwDeG5M51cu671YwZpU9uAVE\",\"startTimestamp\":1732733107083,\"normalizedCompositeWeight\":0.0047703298738510377733,\"stake\":32213778936,\"observerRewardRatioWeight\":0.050000000000000002776},{\"gatewayRewardRatioWeight\":0.89772727272727270709,\"tenureWeight\":0.9777777777777777457,\"stakeWeight\":5,\"compositeWeight\":0.025079365079365076308,\"observerAddress\":\"xN_aVln30LmoCffwmk5_kRkcyQZyZWy1o_TNtM_CTm0\",\"gatewayAddress\":\"xN_aVln30LmoCffwmk5_kRkcyQZyZWy1o_TNtM_CTm0\",\"startTimestamp\":1719295200000,\"normalizedCompositeWeight\":0.0034835882955291399242,\"stake\":50000000000,\"observerRewardRatioWeight\":0.0057142857142857142808},{\"gatewayRewardRatioWeight\":1,\"tenureWeight\":0.11811964313271604288,\"stakeWeight\":3.9284300591000000935,\"compositeWeight\":0.022096416983463169209,\"observerAddress\":\"LtV0aSqgK3YI7c5FmfvZd-wG95TJ9sezj_a4syaLMS8\",\"gatewayAddress\":\"LtV0aSqgK3YI7c5FmfvZd-wG95TJ9sezj_a4syaLMS8\",\"startTimestamp\":1732664603310,\"normalizedCompositeWeight\":0.0030692491350212580854,\"stake\":26885195728,\"observerRewardRatioWeight\":0.047619047619047616404},{\"gatewayRewardRatioWeight\":1,\"tenureWeight\":0.03099603530092592471,\"stakeWeight\":1.5854293432999999602,\"compositeWeight\":0.0098284047784101217365,\"observerAddress\":\"Rlz7oEBtntc0EXkiK2p_L981kY_MYnp_LG7SUESo5_Q\",\"gatewayAddress\":\"Rlz7oEBtntc0EXkiK2p_L981kY_MYnp_LG7SUESo5_Q\",\"startTimestamp\":1734019549659,\"normalizedCompositeWeight\":0.0013651906952765234873,\"stake\":15854293433,\"observerRewardRatioWeight\":0.2000000000000000111},{\"gatewayRewardRatioWeight\":1,\"tenureWeight\":0.11898008629115226775,\"stakeWeight\":1.008999999999999897,\"compositeWeight\":0.0057167098603701244769,\"observerAddress\":\"J40R1BgFSI1_7p25QW49T7P46BePJJnlDrsFGY1YWbM\",\"gatewayAddress\":\"J40R1BgFSI1_7p25QW49T7P46BePJJnlDrsFGY1YWbM\",\"startTimestamp\":1732651221698,\"normalizedCompositeWeight\":0.00079406569885243527985,\"stake\":10090000000,\"observerRewardRatioWeight\":0.047619047619047616404}],\"prescribedNames\":[\"dwedwedwedddd\",\"helpmeeeeddededede\"],\"observations\":{\"failureSummaries\":[],\"reports\":[]},\"startTimestamp\":1734501600000,\"distributionTimestamp\":1734589800000}","Tags":[{"name":"Data-Protocol","value":"ao"},{"name":"Variant","value":"ao.TN.1"},{"name":"Type","value":"Message"},{"name":"Reference","value":"3903"},{"name":"Action","value":"Epoch-Notice"},{"name":"X-Origin","value":""},{"name":"X-Reference","value":""}],"Target":"1234"}],"Output":{"data":"Pruning state at timestamp: 1734561391338\n{\"Type\":\"Message\",\"Timestamp\":1734561391338,\"Variant\":\"ao.TN.1\",\"Cast\":false,\"Cron\":false,\"From\":\"1234\",\"Action\":\"Epoch\",\"_e\":1,\"From-Formatted\":\"1234\",\"Epoch-Index\":176,\"Data-Protocol\":\"ao\",\"Message-Id\":\"1234\"}","print":true,"prompt":"\u001b[32mDevnet ARIO\u001b[90m@\u001b[34maos-2.0.1\u001b[90m[Inbox:\u001b[31m267\u001b[90m]\u001b[0m> "},"Spawns":[]},"timestamp":"2024-12-18T22:37:04.324Z","version":"3.1.0-alpha.6"}```

@fedellen fedellen changed the base branch from PE-7327-format-errors to alpha December 18, 2024 22:38
@dtfiedler dtfiedler self-requested a review December 18, 2024 22:38
@fedellen fedellen merged commit 237294b into alpha Dec 18, 2024
11 checks passed
@dtfiedler
Copy link
Collaborator

🎉 This PR is included in version 3.1.0-alpha.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

@dtfiedler dtfiedler deleted the remove-timestamp branch December 19, 2024 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants