Page MenuHomePhabricator

[64-bit ints] Refactor `CScriptNum` to require setting `nMaxNumSize`
Needs RevisionPublic

Authored by tobias_ruck on Oct 25 2024, 00:21.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Summary

Currently, CScriptNum's constructor and IsMinimallyEncoded have a default for nMaxNumSize, which defaults to 4 (eCash's maximum integer size).

For upgrading Script integers from 32-bit to 64-bit, having to make the integer size explicit allows us to upgrade them based on a script flag.

This has no change in behavior.

Test Plan

ninja check

Diff Detail

Repository
rABC Bitcoin ABC
Branch
interpreter-refactor-script-num-size
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31544
Build 62585: Build Difflint-circular-dependencies · build-without-wallet · build-diff · build-debug · build-clang-tidy · build-clang
Build 62584: arc lint + arc unit

Event Timeline

rebase, also do the same change with ScriptNum10

Fabien requested changes to this revision.Fri, Dec 6, 13:43
Fabien added inline comments.
src/script/script.h
227

This should probably no longer be a CScriptNum member. Why would you pass a static member to the constructor ?

When going from 4 to 8 this variable will need to be moved out anyway.

This revision now requires changes to proceed.Fri, Dec 6, 13:43
src/script/script.h
227

well we can just reference CScriptNum::MAXIMUM_ELEMENT_SIZE, no?

but happy to move it, keep it inside script.h ?

keep in mind that there will be two variables during transition, MAXIMUM_ELEMENT_SIZE_32_BIT and MAXIMUM_ELEMENT_SIZE_64_BIT