-
Notifications
You must be signed in to change notification settings - Fork 50
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
Transaction Validation #736
Conversation
Pull Request Test Coverage Report for Build 8953175335Details
💛 - Coveralls |
678472f
to
a4e5a92
Compare
9f1d83e
to
8614bab
Compare
8818810
to
fdedb60
Compare
Should be good to go now! Some notes:
|
@@ -24,15 +24,20 @@ pub(crate) static INDEX_OF_EVAL_FN: EvalFn = |_env, _ctx, obj, args| { | |||
.get(0) | |||
.cloned() | |||
.ok_or_else(|| EvalError::NotFound("indexOf: missing first arg".to_string()))?; | |||
let fallback_index = args |
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.
indexOf now has the same semantics as scala version, https://github.com/ScorexFoundation/sigmastate-interpreter/blob/efa68e7079393d70d25d43dd63dfba9a18d03415/data/shared/src/main/scala/sigma/ast/methods.scala#L880
Please fix linter issues |
…saction Scala's Short.MaxValue is equivalent to the maximum a 16 bit signed integer can hold
set_hook can only be called once, this means displaying an error multiple times causes a panic in sigma-rust. ignoring seems like the best solution
When converting a signed integer i8 like -1 (0xff) to a bigger signed integer like i64, the 2's complement representation will be padded with ff (0xffffffff...). Thus if input[7] for example is -1, when it is |'ed, all high bits will be set to 1. Converting u8 0xff to i64 0xff leads to correct conversion (0x000000...ff) This fixes validation for transactions like https://ergexplorer.com/transactions#7f838c5060185125cb554323401d87c0fc135a0c5fc545f9e315ffc38b97b06e
The current indexOf implementation doesn't match the behavior of the one in sigmastate-interpreter. The previous version wrongly treated the second argument as a fallback index whereas it is actually the position in the array to start searching from
Some mainnet transactions like 9f4d40607a561c14a504c96919362f150fca3337ab43219d9a683f1617b74b0a have proofs that are smaller than usual but still valid. Relevant sigmastate-interpreter commit ergoplatform/sigmastate-interpreter@ef6ff08
In v5.0 onwards flatMap can have any arbitrary lambda in body as long as it returns a Coll[T]
This brings down TransactionContext creation for transactions with 32767 inputs down from ~1.2 seconds to ~160 milliseconds
This reduces validation time for some transactions like 34fecabe033ca5b516ddaf99a251baf1a580db5be1ccd7ca41bfcd953bb1923f from 11 seconds down to ~1.2
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