Closed SethDusek closed 6 months ago
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
ergo-lib/src/chain/transaction/ergo_transaction.rs | 28 | 29 | 96.55% | ||
ergotree-interpreter/src/eval/error.rs | 0 | 2 | 0.0% | ||
ergotree-interpreter/src/eval/scontext.rs | 3 | 5 | 60.0% | ||
ergotree-interpreter/src/eval/scoll.rs | 8 | 11 | 72.73% | ||
ergotree-ir/src/mir/value.rs | 3 | 6 | 50.0% | ||
ergo-lib/src/chain/transaction.rs | 7 | 11 | 63.64% | ||
ergo-lib/src/chain/transaction/storage_rent.rs | 7 | 21 | 33.33% | ||
ergo-lib/src/chain/parameters.rs | 12 | 28 | 42.86% | ||
ergo-lib/src/wallet/tx_context.rs | 73 | 91 | 80.22% | ||
<!-- | Total: | 165 | 228 | 72.37% | --> |
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
ergotree-interpreter/src/eval/error.rs | 2 | 21.88% | ||
ergotree-ir/src/serialization/types.rs | 6 | 83.28% | ||
<!-- | Total: | 8 | --> |
Totals | |
---|---|
Change from base Build 8951357735: | 0.1% |
Covered Lines: | 10723 |
Relevant Lines: | 13325 |
Should be good to go now! Some notes:
This PR despite the usual unit tests was tested using ergovalidation which downloads transactions from node (requires extra indexing to be enabled) and validates them. After fixing some script bugs we're now down to 15 transactions on mainnet that sigma-rust rejects, all of which rely on buggy behavior from v4.0 that no longer holds in v5.0, including CONTEXT.selfBoxIndex being -1 and sigmaProp(sigmaProp(true)) being allowed. I believe fixing these (and adding version-specific actions to ergotree-interpreter) is out of scope for this PR. Gist of failing transactions
I had to bump rust version since sigma-rust no longer builds as some dependencies don't support rust 1.64 anymore. Clippy rejection seems to be related and should be ignored for now
There are some limitations still in interpreter. The biggest one is that atLeast(0, ...) isn't supported (I plan on addressing this separately in another PR, but I fixed atLeast(1, ...) not being supported in this PR).
There are some breaking changes in this PR, namely ErgoStateContext now also requiring Parameters. I believe this is an acceptable trade-off even if parameters aren't needed for signing. Later when sigma-rust adds support for costing we could use Parameters to calculate costs during signing
Also fixed quadratic scaling in TransactionContext::new old: new:
Please fix linter issues
Initial stateless validation work (things we can validate without needing blockchain context). Also includes a fix where we were allowing as many as u16::MAX inputs/outputs (65535) when ergo only allows i16::MAX (Short.MaxValue in scala) which is (32767). https://github.com/ergoplatform/ergo/blob/48239ef98ced06617dc21a0eee5670235e362933/ergo-core/src/main/scala/org/ergoplatform/modifiers/mempool/ErgoTransaction.scala#L93