Skip to content

Update README.md - #13

Closed
ghost wants to merge 11 commits into
masterfrom
unknown repository
Closed

ghost wants to merge 11 commits into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Feb 15, 2021

Copy link
Copy Markdown

No description provided.

@jaekwon
jaekwon force-pushed the master branch 2 times, most recently from 15b0249 to 3ac9f13 Compare August 28, 2021 02:37
@jaekwon

jaekwon commented Jan 13, 2022 •

Copy link
Copy Markdown
Contributor

Thank you, I will add these changes manually soon. Or if you can update the Pr with the latest, that would help too, sorry for the lateness.

@jaekwon

jaekwon commented Mar 23, 2022

Copy link
Copy Markdown
Contributor

thank you for the contribution. I believe these are marged manually.

@jaekwon jaekwon closed this Mar 23, 2022
@moul moul added this to the 🏗1️⃣ test1.gno.land milestone Oct 20, 2022
thehowl added a commit that referenced this pull request Jan 15, 2024
Before:

```
gno test -verbose .
=== RUN   TestFtoa
panic: cannot convert BigintKind to Uint64Kind

goroutine 1 [running]:
github.com/gnolang/gno/gnovm/pkg/gnolang.ConvertTo(0x0, {0xecc8b8, 0xc00026c3f0}, 0xc00011e190, {0xebe6d8, 0xeb0d78})
        /home/howl/oc/gno/gnovm/pkg/gnolang/values_conversions.go:868 +0x6479
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).doOpConvert(0xc0000f4a20)
        /home/howl/oc/gno/gnovm/pkg/gnolang/op_expressions.go:699 +0x71
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).Run(0xc0000f4a20)
        /home/howl/oc/gno/gnovm/pkg/gnolang/machine.go:1227 +0xfce
[... more stacktrace ...]
```

After:

```
=== RUN   TestFtoa
.: test pkg: panic: cannot convert BigintKind to Uint32Kind
gno machine: Machine:
    CheckTypes: false
	Op: [OpHalt OpBody OpRangeIter OpPopBlock OpBody OpReturn OpBody OpPopResults OpExec OpBody OpPopResults OpExec OpBody OpForLoop OpPopBlock OpBody OpDefine OpBody OpReturn OpPrecall OpBody OpPopBlock OpBody OpPopBlock OpBody OpPopBlock OpBody OpPopResults OpExec OpBody OpDefine]
	Values: (len: 9)
          #8 (ryuFtoaFixed32 func(d *gno.land/r/fG5GBXmX.decimalSlice,mant uint32,exp int,prec int)())
          #7 (genericFtoa func(dst []uint8,val float64,fmt uint8,prec int,bitSize int)( []uint8))
          #6 (typeval{string} type{})
          #5 (FormatFloat func(f float64,fmt uint8,prec int,bitSize int)( string))
          #4 (TestFtoa func(t *testing.T)())
          #3 (tRunner func(t *testing.T,fn testing.testingFunc,logSteps bool)())
          #2 (RunTest func(runFlag string,verbose bool,test testing.InternalTest)(ret string))
          #1 (slice[(struct{("TestFtoa" string),(TestFtoa func(t *testing.T)())} testing.InternalTest),(struct{("TestFormatFloatInvalidBitSize" string),(TestFormatFloatInvalidBitSize func(t *testing.T)())} testing.InternalTest)] []testing.InternalTest)
          #0 (runtest func(name string)(report string))
	Exprs:
          #0 (const-type string)(genericFtoa<VPBlock(3,12)>((const (make func(t type{},z ...interface{})( []uint8)))([](const-type uint8), (const (0 int)), max<VPBlock(3,21)>(prec<VPBlock(1,2)> + (const (4 int)), (const (24 int)))), f<VPBlock(1,0)>, fmt<VPBlock(1,1)>, prec<VPBlock(1,2)>, bitSize<VPBlock(1,3)>))
	Stmts:
          #16 bodyStmt[0/0/12]=di<VPBlock(1,7)>, dfrac<VPBlock(1,12)> := di<VPBlock(1,7)> >> extra<VPBlock(1,10)>, di<VPBlock(1,7)> & extraMask<VPBlock(1,11)>*
          #15 return
          #14 bodyStmt[0/0/2]=ok<VPBlock(4,12)> = (const (true bool))
          #13 bodyStmt[0/0/4]=(end)
          #12 bodyStmt[0/0/1]=(end)
          #11 bodyStmt[0/0/14]=if !ok<VPBlock(2,12)> { return bigFtoa<VPBlock(4,13)>(dst<VPBlock(2,0)>, prec<VPBlock(2,3)>, fmt<VPBlock(2,2)>, (const-type bool)(neg<VPBlock(2,8)>), mant<VPBlock(2,10)>, exp<VPBlock(2,9)>, flt<VPBlock(2,7)>) }
          #10 bodyStmt[0/0/1]=(end)
          #9 bodyStmt[0/0/1]=if (const-type bool)(s<VPBlock(2,0)> != test<VPBlock(3,1)>.s) { t<VPBlock(4,0)>.Error((const ("testN=32" string)), test<VPBlock(3,1)>.f, (const-type string)(test<VPBlock(3,1)>.fmt), test<VPBlock(3,1)>.prec, (const ("want" string)), test<VPBlock(3,1)>.s, (const ("got" string)), s<VPBlock(2,0)>) }*
          #8 bodyStmt[0/0/6]=(end)
          #7 bodyStmt[0/0/1]=(end)
          #6 return
          #5 bodyStmt[0/0/4]=t<VPBlock(1,0)>.finished = (const (true bool))
          #4 return
          #3 bodyStmt[0/0/3]=report<VPBlock(1,5)> := t<VPBlock(1,4)>.report()
          #2 bodyStmt[0/0/1]=(end)
          #1 bodyStmt[2/0/1]=(end)
          #0 bodyStmt[0/0/1]=panic((const ("no such test: " string)) + name<VPBlock(1,0)>)*
	Blocks:
          @(1) Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc004f2d2c0,Source:func ryuFtoaFixed32(d *(decimalS...,Parent:0xc000bf43c0)
            d: (&0xc004331cb8.(*gno.land/r/fG5GBXmX.decimalSlice) *gno.land/r/fG5GBXmX.decimalSlice)
            mant: (16777216 uint32)
            exp: (-23 int)
            prec: (6 int)
            e2: (-24 int)
            q: (5 int)
            exact: (true bool)
            di: (1638400000 uint32)
            dexp2: (-14 int)
            d0: (true bool)
            extra: (14 uint)
            extraMask: (undefined)
            dfrac: (undefined)
            roundUp: (undefined)
 (s vals) @(1) Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc00036bc20,Source:func ryuFtoaFixed32(d *(decimalS...,Parent:0xc00052f620)
            d: (nil *gno.land/r/fG5GBXmX.decimalSlice)
            mant: (0 uint32)
            exp: (0 int)
            prec: (0 int)
            e2: (0 int)
            q: (0 int)
            exact: (false <untyped> bool)
            di: (0 uint32)
            dexp2: (0 int)
            d0: (false bool)
            extra: (0 uint)
            extraMask: (0 uint32)
            dfrac: (0 uint32)
            roundUp: (false bool)
 (s typs) @(1) [*gno.land/r/fG5GBXmX.decimalSlice uint32 int int int int <untyped> bool uint32 int bool uint uint32 uint32 bool]
          @(2) Block(ID:89285d5563b8e2373ce3416c367151d9c4102930:5,Addr:0xc000bf43c0,Source:file{ package strconv; import bi...,Parent:0xc0003325a0)
            bits: (package(bits math/bits) package{})
 (s vals) @(2) Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc00052f620,Source:file{ package strconv; import bi...,Parent:0xc00037ede0)
            bits: (package(bits math/bits) package{})
 (s typs) @(2) [package{}]
          @(3) gno.land/r/fG5GBXmX
	Blocks (other):
          #13 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc004f2d0e0,Source:if (const-type bool)(bitSize<VPB...,Parent:0xc004f2cd20)
 (static) #13 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc00016b020,Source:if (const-type bool)(bitSize<VPB...,Parent:0xc00016bac8)
          #12 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc004f2cd20,Source:if (const-type bool)(fmt<VPBlock...,Parent:0xc004f2cb40)
 (static) #12 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc00016b820,Source:if (const-type bool)(fmt<VPBlock...,Parent:0xc000170568)
          #11 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc004f2cb40,Source:if (const-type bool)(shortest<VP...,Parent:0xc004f2be00)
 (static) #11 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc000170020,Source:if (const-type bool)(shortest<VP...,Parent:0xc000701420)
          #10 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc004f2be00,Source:func genericFtoa(dst [](const-ty...,Parent:0xc0017a0000)
            dst: (slice[0x] []uint8)
            val: (1 float64)
            fmt: (101 uint8)
            prec: (5 int)
            bitSize: (32 int)
            .res_0: (nil []uint8)
            bits: (1065353216 uint64)
            flt: (&0xc005fd7668.(*gno.land/r/fG5GBXmX.floatInfo) *gno.land/r/fG5GBXmX.floatInfo)
            neg: (false bool)
            exp: (0 int)
            mant: (8388608 uint64)
            digs: (struct{(slice[0x000000000000000000000000000000000000000000000000] []uint8),(0 int),(0 int)} gno.land/r/fG5GBXmX.decimalSlice)
            ok: (false bool)
            shortest: (false bool)
 (static) #10 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc000701420,Source:func genericFtoa(dst [](const-ty...,Parent:0xc00023c2e0)
            dst: (nil []uint8)
            val: (0 float64)
            fmt: (0 uint8)
            prec: (0 int)
            bitSize: (0 int)
            .res_0: (nil []uint8)
            bits: (undefined)
            flt: (undefined)
            neg: (false <untyped> bool)
            exp: (0 int)
            mant: (0 uint64)
            digs: (undefined)
            ok: (false bool)
            shortest: (false <untyped> bool)
          #9 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc004f2b680,Source:func FormatFloat(f (const-type f...,Parent:0xc0017a0000)
            f: (1 float64)
            fmt: (101 uint8)
            prec: (5 int)
            bitSize: (32 int)
            .res_0: ( string)
 (static) #9 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc000700c20,Source:func FormatFloat(f (const-type f...,Parent:0xc00023c2e0)
            f: (0 float64)
            fmt: (0 uint8)
            prec: (0 int)
            bitSize: (0 int)
            .res_0: ( string)
          #8 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc004f2b4a0,Source:if (const-type bool)((const-type...,Parent:0xc004d60780)
 (static) #8 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc0004e4020,Source:if (const-type bool)((const-type...,Parent:0xc0003fac20)
          #7 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc004d60780,Source:for i<VPBlock(1,0)> := (const (0...,Parent:0xc004d605a0)
            i: (0 int)
            test: (&0xc0080f1300.(*gno.land/r/fG5GBXmX.ftoaTest) *gno.land/r/fG5GBXmX.ftoaTest)
            s: ("1.00000e+00" string)
            x: (slice[0x616263312E3030303030652B3030] []uint8)
 (static) #7 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc0003fac20,Source:for i<VPBlock(1,0)> := (const (0...,Parent:0xc000101420)
            i: (0 int)
            test: (nil *gno.land/r/fG5GBXmX.ftoaTest)
            s: ( string)
            x: (nil []uint8)
          #6 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc004d605a0,Source:func TestFtoa(t *(testing<VPBloc...,Parent:0xc008cd8000)
            t: (&0xc0049c01e0.(*testing.T) *testing.T)
 (static) #6 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc000101420,Source:func TestFtoa(t *(testing<VPBloc...,Parent:0xc0004ee020)
            t: (nil *testing.T)
          #5 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc004c39c20,Source:func tRunner(t *(T<VPBlock(2,3)>...,Parent:0xc0083aa780)
            t: (&0xc0049c01e0.(*testing.T) *testing.T)
            fn: (TestFtoa func(t *testing.T)())
            logSteps: (false bool)
 (static) #5 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc001ff8020,Source:func tRunner(t *(T<VPBlock(2,3)>...,Parent:0xc0008ed620)
            t: (nil *testing.T)
            fn: (nil testing.testingFunc)
            logSteps: (false bool)
          #4 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc004c39860,Source:func RunTest(runFlag (const-type...,Parent:0xc0083aa780)
            runFlag: ("" string)
            verbose: (true bool)
            test: (struct{("TestFtoa" string),(TestFtoa func(t *testing.T)())} testing.InternalTest)
            ret: ( string)
            t: (&0xc0049c01e0.(*testing.T) *testing.T)
            report: (undefined)
            out: (undefined)
 (static) #4 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc001fefc20,Source:func RunTest(runFlag (const-type...,Parent:0xc0008ed620)
            runFlag: ( string)
            verbose: (false bool)
            test: (nil testing.InternalTest)
            ret: ( string)
            t: (nil *testing.T)
            report: (nil testing.Report)
            out: (nil gonative{[]uint8})
          #3 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc004c39680,Source:if (const-type bool)(test<VPBloc...,Parent:0xc004c394a0)
 (static) #3 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc0083f1020,Source:if (const-type bool)(test<VPBloc...,Parent:0xc00bfc6f20)
          #2 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc004c394a0,Source:for _<VPBlock(0,0)>, test<VPBloc...,Parent:0xc004c392c0)
            test: (struct{("TestFtoa" string),(TestFtoa func(t *testing.T)())} testing.InternalTest)
 (static) #2 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc00bfc6f20,Source:for _<VPBlock(0,0)>, test<VPBloc...,Parent:0xc009e5e420)
            test: (nil testing.InternalTest)
          #1 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc004c392c0,Source:func runtest(name (const-type st...,Parent:0xc004c38f00)
            name: ("TestFtoa" string)
            report: ( string)
 (static) #1 Block(ID:0000000000000000000000000000000000000000:0,Addr:0xc009e5e420,Source:func runtest(name (const-type st...,Parent:0xc0082d1ba0)
            name: ( string)
            report: ( string)
	Frames:
          #8 [FRAME FUNC:ryuFtoaFixed32 RECV:(undefined) (4 args) 28/8/1/15/14 LASTPKG:gno.land/r/fG5GBXmX LASTRLM:Realm{Path:"gno.land/r/fG5GBXmX",Time:881}#89285D5563B8E2373CE3416C367151D9C4102930]
          #7 [FRAME FUNC:genericFtoa RECV:(undefined) (5 args) 20/7/1/11/10 LASTPKG:gno.land/r/fG5GBXmX LASTRLM:Realm{Path:"gno.land/r/fG5GBXmX",Time:881}#89285D5563B8E2373CE3416C367151D9C4102930]
          #6 [FRAME FUNC:FormatFloat RECV:(undefined) (4 args) 17/5/0/10/9 LASTPKG:gno.land/r/fG5GBXmX LASTRLM:Realm{Path:"gno.land/r/fG5GBXmX",Time:881}#89285D5563B8E2373CE3416C367151D9C4102930]
          #5 [FRAME LABEL:  13/5/0/8/7]
          #4 [FRAME FUNC:TestFtoa RECV:(undefined) (1 args) 11/4/0/6/6 LASTPKG:testing LASTRLM:Realm{Path:"gno.land/r/fG5GBXmX",Time:881}#89285D5563B8E2373CE3416C367151D9C4102930]
          #3 [FRAME FUNC:tRunner RECV:(undefined) (3 args) 8/3/0/4/5 LASTPKG:testing LASTRLM:Realm{Path:"gno.land/r/fG5GBXmX",Time:881}#89285D5563B8E2373CE3416C367151D9C4102930]
          #2 [FRAME FUNC:RunTest RECV:(undefined) (3 args) 6/2/0/3/4 LASTPKG:gno.land/r/fG5GBXmX LASTRLM:Realm{Path:"gno.land/r/fG5GBXmX",Time:881}#89285D5563B8E2373CE3416C367151D9C4102930]
          #1 [FRAME LABEL:  2/1/0/1/2]
          #0 [FRAME FUNC:runtest RECV:(undefined) (1 args) 1/0/0/0/1 LASTPKG:gno.land/r/fG5GBXmX LASTRLM:Realm{Path:"gno.land/r/fG5GBXmX",Time:881}#89285D5563B8E2373CE3416C367151D9C4102930]
	Realm:
	  gno.land/r/fG5GBXmX
	Exceptions:
	  []
	  
stracktrace:
test.go:446               main.runTestFiles.func1
panic.go:914              runtime.gopanic
values_conversions.go:868 gnolang.ConvertTo
op_expressions.go:699     gnolang.(*Machine).doOpConvert
machine.go:1227           gnolang.(*Machine).Run
machine.go:636            gnolang.(*Machine).Eval
test.go:478               main.runTestFiles
test.go:346               main.gnoTestPkg
test.go:257               main.execTest
test.go:99                main.newTestCmd.func1
command.go:233            commands.(*Command).Run
command.go:237            commands.(*Command).Run
command.go:118            commands.(*Command).ParseAndRun
main.go:14                main.main
proc.go:267               runtime.main
asm_amd64.s:1650          runtime.goexit
; panic: gno.land/r/fG5GBXmX_test/decimal_test.gno:5: dot imports not allowed in Gno
gno machine: Machine:
    CheckTypes: false
	Op: []
	Values: (len: 0)

	Exprs:

	Stmts:

	Blocks:
          @(1) gno.land/r/fG5GBXmX_test
	Blocks (other):

	Frames:

	Realm:
	  gno.land/r/fG5GBXmX_test
	Exceptions:
	  []
	  
stracktrace:
stracktrace:
…no/gnovm/cmd/gno/test.go:446  main.runTestFiles.func1
…/go/src/runtime/panic.go:914  runtime.gopanic
…kg/gnolang/preprocess.go:173  gnolang.Preprocess.func2.1
…/go/src/runtime/panic.go:920  runtime.gopanic
…o/src/math/big/natdiv.go:520  big.nat.div
…b/go/src/math/big/int.go:268  big.(*Int).Quo
…pkg/gnolang/op_binary.go:870  gnolang.quoAssign
…pkg/gnolang/op_binary.go:256  gnolang.(*Machine).doOpQuo
…m/pkg/gnolang/machine.go:1154 gnolang.(*Machine).Run
…m/pkg/gnolang/machine.go:662  gnolang.(*Machine).EvalStatic
…kg/gnolang/preprocess.go:2150 gnolang.evalConst
…kg/gnolang/preprocess.go:784  gnolang.Preprocess.func2
…kg/gnolang/transcribe.go:728  gnolang.transcribe
…kg/gnolang/transcribe.go:371  gnolang.transcribe
…kg/gnolang/transcribe.go:670  gnolang.transcribe
…kg/gnolang/transcribe.go:708  gnolang.transcribe
…kg/gnolang/transcribe.go:133  gnolang.Transcribe
…kg/gnolang/preprocess.go:149  gnolang.Preprocess
…m/pkg/gnolang/machine.go:443  gnolang.(*Machine).runFiles
…m/pkg/gnolang/machine.go:398  gnolang.(*Machine).RunFiles
…no/gnovm/cmd/gno/test.go:466  main.runTestFiles
…no/gnovm/cmd/gno/test.go:346  main.gnoTestPkg
…no/gnovm/cmd/gno/test.go:257  main.execTest
…no/gnovm/cmd/gno/test.go:99   main.newTestCmd.func1
…/pkg/commands/command.go:233  commands.(*Command).Run
…/pkg/commands/command.go:237  commands.(*Command).Run
…/pkg/commands/command.go:118  commands.(*Command).ParseAndRun
…no/gnovm/cmd/gno/main.go:14   main.main
…b/go/src/runtime/proc.go:267  runtime.main
…/src/runtime/asm_amd64.s:1650 runtime.goexit

FAIL
FAIL    . 	2.19s
FAIL
FAIL
FAIL: 0 build errors, 1 test errors
```
zivkovicmilos added a commit that referenced this pull request Jun 24, 2024
* Add runPropose verification

* Add runPrevote verification

* Add prevote step timeout

* Add runPrecommit verification

* Update watchForRoundJumps

* Add missing cleanup, broadcast

* Clean up the consensus state

* Remove leftover comment

* Simplify the final timer expiring

* Add additional comments to the types

* Add support for options

* Swap out the useless bloom
zivkovicmilos pushed a commit that referenced this pull request May 30, 2025
matijamarjanovic added a commit to matijamarjanovic/gno that referenced this pull request Aug 18, 2025
adds approve realm func that does the same as approve only instead of
address it takes string pkg path as an argument, derives address and
calles standard approve

Co-authored-by: Stefan Nikolic <[email protected]>
clockworkgr added a commit that referenced this pull request Apr 17, 2026
…ness, hot-path polish

A broad line-by-line follow-up review surfaced a collection of latent
hazards and low-severity improvements across correctness, robustness,
performance, and API ergonomics. This commit closes all of them without
altering core behaviour (tree structure, hashing, versioning, proof
format are untouched).

Correctness

- Finding #6: refinements around valueKey sentinel handling to avoid
  ambiguity with the all-zero ValueKey.
- Finding #7: MutableTree is single-writer — all methods (including
  read-only Get / Has / Iterate / proof generation) mutate tree-level
  caches or lazy childNodes and must be serialised externally. This is
  now documented in README.md and on the MutableTree / ImmutableTree
  struct doc comments. TestConcurrent_LazyLoadFromDB exercises
  concurrent Has on a lazy ImmutableTree under -race.
- Finding #9: proof generation over a MutableTree root reads miniTree
  state that Set rewrites in place. GetMembershipProof /
  GetNonMembershipProof and immutableForProof now carry explicit
  doc-comments stating callers MUST NOT mutate the tree during proof
  construction.
- Findings #10 / #11: distinguish missing-key from missing-resolver.
  Iterate without a resolver returns ErrNoValueResolver instead of
  silently yielding 32-byte value hashes masquerading as values;
  Get / Iterate / GetByIndex surface ErrNoValueResolver through the
  resolver. ErrKeyDoesNotExist now only means the key is absent.
- Findings #15 / #40: prune-reader TOCTOU is closed by pruneMu (held
  across the beginPruning / endPruning window). GetImmutable and
  immutableForProof now register the reader BEFORE loading the root
  so the reader-side ordering matches the prune side.
- Finding #43: deleteAllNodesForVersion now loads the orphan list,
  deletes every value record, and deletes the orphan list itself —
  defensively, since today the path is unreachable under the current
  toVersion >= latest guard but any future relaxation would have
  silently leaked values.
- Finding #46: markReachable and sweepOld now call a shared
  assertLeafChildren helper at every inner branch. It probes the first
  available child (in-memory or first serialised ref) once per parent
  and verifies (inner.height == 1) == child is *LeafNode. Violations
  surface as a typed ErrHeightInvariantViolated sentinel; the prune
  caller can roll back instead of silently corrupting the reachable
  set.

Robustness

- Finding #13: nodeDB lock discipline is now documented on the struct.
  mtx guards version metadata; pruneMu serialises prune with reader
  registration (always acquired before mtx); batch, nextNonce, and
  pendingEvicts are single-writer by design.
- Finding #18: InnerNode.Serialize asserts child-ref length before
  writing (carried over from prior work).
- Finding #38: Commit now documents that on write error the pending
  batch is lost and the caller must either reconstruct the in-flight
  state or roll back to a consistent checkpoint. Cache evictions
  queued by DeleteNode are discarded on error.
- Finding #42: the unwired AsyncPruning option was removed from
  Options, eliminating the only code path that would have introduced
  a second writer goroutine against ndb.batch.
- Finding #44: DeleteNode now defers cache eviction to Commit —
  ndb.pendingEvicts accumulates cache keys and flushes only after the
  batch write succeeds. Closes a theoretical race where a cache-miss
  reader could reload from the still-populated DB after eviction but
  before the batch flushes, then re-cache a node whose deletion now
  lives on disk. The prune-reader invariant makes this dormant today,
  but deferring the eviction codifies the contract.
- Finding #45: ImmutableTree.Close is now guarded by sync.Once. Double
  or concurrent Close previously over-decremented the reader count,
  which would have allowed a prune to proceed while other snapshots of
  the same version were still live.
- Finding #47: nodeKeyBytesToArr now panics with a clear diagnostic on
  short slices instead of silently zero-padding (which would silently
  miscompare against the reachable set).
- Finding #52: mid-loop errors in PruneVersionsTo now discard the
  partial batch via discardBatch() before returning. The next Commit
  would otherwise flush deletes for versions that were never fully
  pruned, leaving disk and firstVersion bookkeeping inconsistent.

Performance

- Finding #16: iterator now prefetches every occupied slot's value on
  the first Value() call after a leaf transition and caches them on
  the iterator; setLeaf invalidates the cache on every transition.
  Amortises per-call overhead and surfaces resolver errors at the
  first Value() instead of arbitrarily later.
- Finding #21 (remaining bullets): hot-path allocations cleaned up —
  Hash() slice caching, mini-merkle SiblingPath stack allocation,
  mini_merkle Clear() via struct copy of a package-level template,
  leaf/inner split stack arrays, and a merged non-membership walk.
- Finding #29: InnerNode.Clone no longer re-runs Build() after the
  struct copy; the intermediate miniTree layer is copied by value so
  subsequent SetSlot calls keep their fast incremental walk-up.
- Finding #49: sweepOld now checks reachable[nk] for in-memory
  children before descending, mirroring the serialised-ref shortcut.
  Avoids pointless call-frames for shared subtrees.
- Finding #51: leaf-skip savings comment now derives the 32/33 ≈ 97%
  figure from B = 32 so a future branch factor change can re-derive
  the win in one step.

API ergonomics and code quality

- Finding #12: public methods that panicked (LoadVersionForOverwriting,
  DeleteVersionsFrom) now return ErrUnsupported (carried over).
- Finding #19: iterateNode was removed alongside the hash-as-value
  fallback once Finding #11 landed; only iterateNodeResolved remains,
  and a comment at its declaration site documents the removal.
- Finding #22: proof_spec.go MaxPrefixLength and MaxDepth are now
  documented inline with derivations — MaxPrefixLength = 1 is correct
  because ICS23 adds maxLeftChildBytes internally; MaxDepth = 60
  covers 12 inner levels × 5 mini-merkle ops ≈ 32**12 entries.
- Finding #24: LeafNode.Clone and InnerNode.Clone carry explicit doc
  comments on the slice-header aliasing invariant; redistribute /
  merge paths call assertCloned at entry.
- Finding #27: export.go separator keys are deep-copied into a fresh
  sepKeys slice so a concurrent mutator on a shared root cannot tear
  key bytes mid-export. Importer.Close now deletes values eagerly
  written by Add when Commit has not succeeded and is idempotent;
  savedVKs is nulled on commit so post-commit Close does not try to
  delete values the tree now owns.
- Finding #33: iterator.seekLast now decrements childIdx when
  end == keys[childIdx-1], avoiding one over-descent plus prevLeaf.
- Finding #34: iterator Value() / Next() record resolver errors on
  it.err and the contract ("always Error() after Valid() == false")
  is documented.
- Finding #35: MutableTree.Iterator now errors early when ndb == nil
  && memValues == nil instead of silently yielding nil values.
- Finding #36: SaveVersion resets session counters only after a
  successful Commit; a failed Commit now triggers Rollback so the
  next SaveVersion does not reuse nonces from the failed attempt.
- Finding #37: treeRemove root-collapse preserves the surviving
  child's ndb; documented in the code.
- Finding #38: Commit lifecycle contract documented at the method
  boundary.
- Finding #39: Importer resets host-tree counters on Import() so a
  fresh import cannot inherit session state from prior Sets.
- Finding #41: PruneVersionsTo setFirstVersion is advance-only; a
  caller passing toVersion < getFirstVersion() - 1 no longer rewinds
  the bookkeeping below the true first retained version.
- Finding #50: deleteSubtree now prefers inner.childNodes[i] when set,
  falling back to GetNode(children[i]). A caller handing in a tree
  with unsaved children would otherwise have leaked subtrees.

Tests

- TestMutableTree_COW_OldReferencesValid: update to iterateNodeResolved
  after the iterateNode removal.

All existing tests pass under -short and -race.
jaekwon added a commit that referenced this pull request Apr 25, 2026
…pr and interface field sites (BINARY_FIXES #13,#26)

Widens writeLengthPrefixedField and writeInterfaceFieldMarshal to mirror
reflect's writeFieldIfNotEmpty (binary_encode.go:592): the outer field
is elided when the inner body is zero-length OR exactly one byte of
value 0x00. Together with #4/#22 (Any field 2), the rollback contract
is now uniform across all three emission-site kinds (struct-repr /
Time / Duration / nested struct, interface, and Any.Value).

Structural hardening — today no generator-emitted MarshalBinary2 can
produce [0x00] output (writeReprMarshal rolls that back at the top
level, and MarshalAnyBinary2 always emits the TypeURL field), but the
gate must hold for hand-written MarshalBinary2 and future emission
paths.

Adds generator-output inspection tests in genproto2_test.go anchored
on PrimitivesStruct (Time/Duration/nested-struct sites) and ReprElem2
(interface site). Regenerates all pb3_gen.go with the new gate.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
jaekwon added a commit that referenced this pull request Apr 25, 2026
…arshal default branch (BINARY_FIXES #16)

The default (primitive) branch of writeFieldValueMarshal previously
emitted value + field key unconditionally, ignoring the writeEmpty
parameter. Reflect's writeFieldIfNotEmpty (binary_encode.go:592) has
a uniform single-0x00 rollback for ALL field kinds.

Every current caller wraps the default branch in an outer zeroCheck,
so primitive zero-values never reach the branch today (FuzzUnsafeFloat
is the only registered type whose float fields reach the branch
without outer zeroCheck — but float zero is 4/8 bytes, never single
0x00). The fix is defensive hardening: a future caller that omits the
outer zeroCheck would otherwise silently emit stray <key> 0x00 bytes.

Sibling/uniform-contract fix matching the rollbacks already at
writeLengthPrefixedField (#26), writeInterfaceFieldMarshal (#13), and
writeReprMarshal's primitive branch.

Adds TestWriteFieldValueMarshal_DefaultBranchRollback anchored on
FuzzUnsafeFloat. Regenerates all pb3_gen.go.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
jaekwon added a commit that referenced this pull request Apr 25, 2026
…byte field branches (BINARY_FIXES #20)

Reflect's writeFieldIfNotEmpty (binary_encode.go:592) rolls back when
the value is a single 0x00 byte and !isWriteEmpty. The String, []byte
slice, and [N]byte array branches of writeFieldValueMarshal previously
emitted PrependString / PrependByteSlice + field key unconditionally,
ignoring the writeEmpty argument.

Reachability today: outer field-level zeroCheck filters empty strings
and empty []byte before they reach writeFieldValueMarshal. But [N]byte
arrays have empty zeroCheck (Array kind not in the zeroCheck switch),
so the filter is bypassed; for `[0]byte` (or any field where the array
prepend emits exactly [0x00]) the bug is reachable. AminoMarshaler-
non-struct routing through writeFieldValueMarshal is the original
#20 motivation.

Add a `writeByteLengthFieldWithRollback` helper:
  if writeEmpty: unconditional emit
  else: { before := offset; valueStmt; valueLen := before - offset;
          if valueLen > 1 || (valueLen == 1 && buf[offset] != 0x00) { key }
          else { offset = before } }

Switch the three branches of writeFieldValueMarshal to use the helper.
Sibling of #16 (default-branch rollback), #26 (writeLengthPrefixedField),
and #13 (writeInterfaceFieldMarshal) — completes uniform single-0x00
rollback contract across all length-prefixed emission sites.

List emission sites (writePackedSliceReprMarshal, writeSliceReprMarshal,
writeUnpackedListMarshal) intentionally NOT covered: reflect's per-element
encoding in lists does not go through writeFieldIfNotEmpty (list element
emission repeats the field key as-is, no rollback contract).

Adds TestWriteFieldValueMarshal_StringByteSliceByteArrayRollback
asserting the rollback predicate appears at PrimitivesStruct (Str,
Bytes) and ArraysStruct (ByteAr) emission sites.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
jaekwon added a commit that referenced this pull request Apr 25, 2026
…g layer

Two earlier commits (3ddb46b #13 + #26) added single-0x00 rollback
gates at writeInterfaceFieldMarshal and writeLengthPrefixedField. Both
operate on `anyLen`/`dataLen` at the INNER-BODY layer (bytes BEFORE
the length prefix is added), but reflect's writeFieldIfNotEmpty
rollback (binary_encode.go:592) operates at the OUTER-VALUE layer
(post-prefix).

Trace for Typ3ByteLength struct field with hypothetical 1-byte body
[0x00]:
  Reflect:
    encodeReflectBinaryStruct → writeMaybeBare(content=[0x00], bare=false)
    → EncodeByteSlice → writes <0x01><0x00> = 2 bytes value.
    writeFieldIfNotEmpty:592 check: lAfterValue - lBeforeValue = 2,
    not 1 → NO ROLLBACK. Emits <key> 0x01 0x00 = 3 bytes wrapped.
  Generator post-#13/#26:
    dataLen = 1, buf[offset] = 0x00 → ROLLS BACK. Emits 0 bytes.
    DIVERGENCE.

The pre-fix code (`if dataLen > 0`) matched reflect: it rolled back
only when the inner body was empty (dataLen == 0), which corresponds
to reflect's writeMaybeBare empty-contents branch writing a lone
[0x00] length-byte that THEN triggers reflect's :592 rollback.

Two independent subagent traces confirmed: reflect emits 3 bytes for
this case; generator post-#13/#26 emits 0 bytes; pre-fix matched.
The case is unreachable today (no MarshalBinary2 produces a 1-byte
[0x00] body — writeReprMarshal rolls that back at the top level;
MarshalAnyBinary2 always emits TypeURL ≥ 6 bytes), but the post-fix
direction is wrong.

Revert:
  - writeLengthPrefixedField: gate back to `if dataLen > 0`.
  - writeInterfaceFieldMarshal: drop the rollback wrapper.
  - Update tests to assert the correct (reverted) state with
    explanatory layer notes.

Note: #20's writeByteLengthFieldWithRollback (String/[]byte/[N]byte)
operates at the OUTER-VALUE layer because PrependString/ByteSlice
write the whole `<uvarint-len><content>` block — `valueLen` there
matches reflect's lAfterValue-lBeforeValue. Correct, kept as-is.
Same for writeReprMarshal default branch (#16-style) and
writeFieldValueMarshal default branch (#16): primitive emission, no
length prefix, valueLen == primitive bytes — same layer as reflect's
:592 for non-ByteLength typ3.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
aeddi pushed a commit that referenced this pull request Nov 17, 2026
…ands at 1024B (#13)

* fix(gnovm): cap crypto/modexp operand lengths to match its gas model

crypto/modexp.ModExp is charged Base + Slope*len(modulus) — linear, and on the
modulus alone (gnovm/stdlibs/native_gas.go) — while big.Int.Exp costs
O(bitlen(exp) * words(modulus)^2) plus a reduction of base modulo modulus. The
slope was fit against the benchmark shape len(base)==len(exp)==len(modulus)==N
anchored at N=256, so every other shape decouples the charge from the real
cost. Measured from Gno via a filetest, gas consumed vs wall time:

  - 500KB exponent, 256-byte modulus:  6,736,092 gas,   5.06s
  - 32KB modulus, 256-byte exponent:   789,026,593 gas, 33.7s
  - 500KB base, 32-byte modulus:       828,240 gas,     61ms

Allocation gas is a log2 table lookup, so building the oversized operand is
nearly free — make([]byte, n) with only the top byte set is a full-width
integer. Two calls sharing one 16MB exponent against a 32-byte modulus cost
4,243,223 gas total and ran for 22.98s. At the production 3B per-block gas
limit, one transaction reusing a single such exponent buys hours of validator
stall, and crypto/modexp is importable by any user realm.

Bound each operand, as EIP-7823 does for the equivalent EVM precompile, but at
256 bytes rather than its 1024: Ethereum prices the product (EIP-2565,
EIP-7883) and can afford the looser bound, whereas the linear charge here is
already ~3.5x short of the measured cost of the symmetric 512-byte shape. 256
still covers every real use — RSA-2048, BN254 field reduction, and modular
inverse over a 2048-bit prime, where the exponent is as wide as the modulus —
and the only in-tree caller, crypto/cometblszk's hashToField, uses 32-byte
operands. Reaching EIP-7823's 1024 means first charging on
bitlen(exp)*words(modulus)^2; the linear gas schema cannot express a product.

The EIP-198 nagydani-5 vector (1024-byte base and modulus) is beyond the cap
and is now asserted to be rejected. Adding MaxOperandLen to modexp.gno changes
stdlib source bytes, which are committed to genesis state: that moves the
pinned determinism gas (+209, from the new declaration) and the crossrealm38
app hash. Both are updated.

* feat(gnovm): price crypto/modexp on its real cost, raise cap to EIP-7823's 1024

The previous commit capped every modexp operand at 256 bytes because the gas
charge was linear in len(modulus) and could not safely cover more. That cap is
tighter than EIP-7823's 1024 and rejects legitimate work — RSA-4096/8192
verification, and the EIP-198 nagydani-5 vector. Fix the pricing instead, then
raise the cap to 1024.

modexp performs one modular squaring per exponent bit, each O(words(modulus)^2),
so its cost is a product of two operands. Base + Slope*N1 + Slope2*N2 sums
independent lengths and cannot express that, which is why the old row priced the
modulus and charged nothing at all for the exponent. Add SizeModExpWork, a gas
kind that folds the product into one metric the existing single-slope machinery
can price:

  work = 8*len(exp) * (modExpFloorWords + ceil(len(modulus)/8)^2)

The floor term is what lets one coefficient span the range: measured per-
exponent-bit cost is ~82ns at a 32-byte modulus but ~1274ns at 256 bytes, so a
pure words^2 metric needs a coefficient varying ~5x and must either undercharge
small moduli or overcharge large ones. Expressing the overhead in words^2 units
removes that. bits is taken as 8*len(exp) rather than the true bit length: an
upper bound, no operand bytes read, and it matches EIP-2565's use of exp_len —
and since a zero-filled exponent is precisely the cheap-to-build DoS operand,
charging for its length is correct rather than merely conservative.

The metric is read from the two operand lengths already in the call block, so
this needs no Machine in X_modExp and no regenerated dispatcher wrapper.

Slope=4000 is derived from the new ModExpGrid benches, which sweep len(exp) and
len(modulus) independently. ns/op against work fits linearly at R^2=0.999,
confirming a single coefficient does price the product. The value is
deliberately not the fitter's least-squares coefficient: that is a central fit
and by construction sits below cost on about half the grid, which is fine for
describing a cost and wrong for charging one. 4000 is the smallest round value
holding charge >= cost at every grid point projected onto reference hardware
(worst margin ~1.15x, at a 4-byte exponent against a 256-byte modulus, where the
unmodelled base reduction dominates and Base has to carry it).

Real callers get much cheaper, because the old slope charged everyone for a
worst case they never reached: the determinism txtar's on-chain call drops 27%
(2,551,631 -> 1,862,394 gas), cometblszk's hashToField 13.22M -> 12.54M, and
RSA-2048 verify goes from ~6.2M to ~160K. The three DoS shapes are unaffected in
outcome — still refused, since all three exceed 1024 bytes — but are now priced
out as well as rejected.

gen_native_table.py is updated so a regeneration cannot silently reinstate the
vulnerable len(modulus)-only row; it now fits the grid benches through the same
work metric. native_gas_table.go.txt and native_gas_formulas.md still carry the
superseded row: they are the reference-hardware snapshot, regenerated wholesale,
and the exception is documented where the invariant is claimed.

Still draft. Re-fit on the reference Xeon 8168 with the grid, taking an upper
bound rather than the generated coefficient.

* refactor(gnovm): clean up the crypto/modexp gas work, and fix three wrong claims

Follow-up to the two preceding commits, from a review pass over their diff. No
change to the operand cap or to Slope; the security property and the pricing are
as before. Three of these are corrections to claims those commits asserted, which
were checkably false.

Corrections:

  - modexp.go said a symmetric 1024-byte call costs ~372M gas. At the shipped
    Slope it is 526,426,000 — the old figure came from a slope superseded before
    the commit landed. modexp.gno restated it as "over a tenth of a block";
    dropped rather than re-pinned, since baking a figure from a row marked draft
    into public API docs ties the two together and moves the apphash when it rots.
  - modexp.go said the cap bounds the dispatcher's Gno->Go operand copy. It
    cannot: the copy happens in the generated wrapper before X_modExp is entered.
    Worse, the copy is capacity-sized (Gno2GoValue in gonative.go), so no length
    check anywhere fully bounds it — a zero-length slice with a large capacity
    still copies it all. That is pre-existing behaviour shared by every []byte
    native and is now described as such rather than claimed as fixed.
  - native_gas.go said native_gas_table.go.txt and native_gas_formulas.md "still
    carry the superseded len(modulus)-only modexp row". They carry no modexp row
    at all: 46 rows against production's 66, and native_bench_output.txt has no
    bench lines for any IBC crypto native. So the "regeneration reproduces this
    verbatim" invariant was already partial before this work, which is now stated.

Substantive fixes:

  - len(base) is read by no term of the work metric, so the new row charged 68,125
    gas for a huge-base call where the old row charged 828,240 — 12x cheaper to
    trigger the operand copy, a regression on the axis the first commit closed.
    ModExp (modexp.gno) now checks the lengths too, refusing oversized operands
    before the native is dispatched, so no copy and no charge occur. Measured: the
    three DoS shapes together drop from 194.2B gas to 530.8M.
  - SizeModExpWork reads a parameter *pair*, and returned zero work when the
    second was out of range — silently collapsing the charge to Base. The row
    carried SlopeIdx: 2 until recently, and that value trips exactly this path.
    Now validated at init against the generated signatures (panic at boot, matching
    how the rest of this subsystem fails), and rejected outright in post-slope
    position, where it would have priced on a return value's byte length.

Simplifications:

  - modExpWork: clamp both factors, then one division-guarded multiply — 5
    branches to 2, and the overflow import goes away. Also fixes an unchecked
    wrap: (modLen+7)/8 went negative at MaxInt64, which the old code survived only
    because the negative then overflowed the next multiply. Verified identical
    over 1089 boundary pairs and 3M random pairs.
  - benchModExp was a copy of benchModExpGrid with the loop unrolled; it now
    delegates. N=512 is restored, since 512 is inside the 1024 cap.
  - The grid run the Slope was derived from is recorded in the bench file, so the
    margin claim can be checked rather than taken on faith — with the caveat that
    the harness builds list-backed operands, inflating small-exponent corners.
  - Test helpers hoisted to file level per the sibling crypto stdlib tests, ones()
    replaced by bytes.Repeat, the wantNil flag replaced by an expected length, and
    the boundary tests no longer perform a real symmetric 1024-byte modexp to
    prove a length check (crypto/modexp Go tests: 142ms -> 4ms).
  - The guard test asks gnolang for the metric via a new exported ModExpWork
    instead of restating the formula with its own copy of the floor constant; the
    fitter's markdown likewise interpolates MODEXP_FLOOR_WORDS instead of 65.
  - Trimmed the table row comment to the row's own properties and fixed a dangling
    "That corner" that had lost its antecedent.

Both pinned values move again: modexp.gno gains the guard (+12,582 gas on the
determinism txtar, the cost of not paying for the copy on rejection).

* fix(gnovm)!: count modexp's modular multiplications instead of fitting a product

The work-based charge this replaces was fitted, not derived, and the grid it
was fitted over did not cover the shapes where it is thinnest. Three holes
followed from that, all reachable from a realm:

  - Sub-word exponents. big.Int only takes the windowed Montgomery path when
    the exponent exceeds one machine word (nat.go: `if len(y) > 1 && !slow`);
    at or below that it runs the generic loop, which divides every iteration
    instead of reducing in Montgomery form, ~2.5x the cost per exponent bit.
    The grid jumped exp 4 -> 32, straight over the band.
  - A zero-length exponent collapsed the charge to a flat Base regardless of
    modulus size, while the call still allocates and fills len(modulus) bytes.
  - The charge was not monotonic: an 8-byte exponent measured more expensive
    than a 9-byte one while being charged less, because the Montgomery loop
    walks whole words and 8*len(exp) does not.

modExpWork now counts the modular multiplications expNN will perform rather
than fitting a product. Every branch it takes is decided by the operand
lengths alone, so the Montgomery counts (38 setup + 160 per exponent word,
in units of one modular multiplication) are read off nat.go rather than
tuned; only the slope converting units to nanoseconds is hardware-dependent.
The generic branch's 5 units/bit stays calibrated, because nat.div's cost per
word is set by hardware divide latency rather than a multiplication count.

The row gains a second slope on len(modulus) for the dispatcher work -
converting operands, allocating the result, filling it - which is linear in
the modulus and runs even with an empty exponent. Folding it into Base is
what made the zero-exponent shape modulus-independent.

Over the recorded grid, projected onto reference hardware, every point now
lands between 1.24x and 2.22x of measured cost, with no undercharge and a
monotonic charge at every modulus.

Also makes the row re-derivable, which it was not:

  - Commits the calibration input. The grid the shipped constants come from
    is now recorded in ibc_native_bench_test.go with the machine, the flags
    and the four anchors behind its 1.85 projection onto the reference Xeon.
  - Extends the grid to the sub-word band and expLen=0, and fills the
    exponent with 0xFF. A patterned fill measures up to 1.75x cheaper at 4
    bytes, so the old grid could not see its own thinnest point.
  - gen_native_table.py gains fit_modexp, which takes maxima rather than
    least squares, and a --hw-factor flag. Running it over the committed grid
    reproduces the shipped row exactly, so the row is a fitter output rather
    than a hand-edit the fitter would silently undo.

Guards: TestModExpRowCoversRecordedGrid checks all 26 points instead of one,
TestModExpChargeMonotonic and TestModExpWorkNoCrossoverInversion pin the
inversion shut, and TestModExpConstantsMatchFitter pins the five constants
the Python copy duplicates. TestModExpWorkSlopeProductFitsInt64 guards
chargeNativeGas's unguarded `gi.Slope * N`; sizing it lowered the saturation
clamp from 1<<50 to 1<<44.

EXACT_GAS moves 1874976 -> 1838073. The delta is entirely the row at this
realm's 32/32-byte shape (139000 -> 102097) and is checkable from the
constants in the txtar comment.

* docs(gnovm): add ADR for the crypto/modexp work metric

Records why the row counts big.Int.Exp's modular multiplications rather than
fitting a product, the two regimes that made a single fitted slope unsound,
and the measurements behind rejecting a pure-Gno math/big implementation
(8,020x slower in the VM; one RSA-2048 exponentiation would need ~10x a
block's gas limit).

* fix(gnovm)!: recalibrate the modexp row on a quiet machine, post data-backing

The committed grid was recorded before this branch merged develop, and #97
(data-back byte slices) invalidated its dispatcher term. Go2GnoValue now
builds a flat Data-backed array instead of one TypedValue per byte, which is
the path the calibration harness feeds operands through, so the measured
per-modulus-byte cost fell from ~134 ns to ~2.9. The expLen=0 points — the
ones that isolate that cost — measured 0.03-0.21x of their old values while
every priced point moved only 0.69-0.98x.

Re-recorded on an idle machine at -count=5 (run-to-run spread 1.02-1.19x at
every point but one) and re-derived:

  Base    250 ->  1400
  Slope  1800 ->  2200
  Slope2 170000 -> 3500   (49x, entirely the data-backing change)

The work metric itself is unchanged — it counts operations, not dispatcher
overhead, so it was not affected. generic_per_bit re-swept to the same 5.

Also corrects the projection factor, in two ways. The anchors re-measure at
2.19-2.33x on the idle machine rather than 1.84-1.91x, and the row now takes
the HIGH end (2.3) rather than the low. That was backwards before: a larger
factor projects a larger cost and so demands a larger slope, making the top
of the measured range the safe choice, not the bottom.

Every grid point lands between 1.24x and 2.57x of projected cost, no
undercharge, monotonic in len(exp) at every modulus. Running the fitter over
the re-recorded grid reproduces the row exactly.

EXACT_GAS 1832872 -> 1850271; the txtar comment reconciles it against
develop from the row constants.

* test(gnovm): mark modexp work-pair subtests parallel
alexiscolin added a commit to alexiscolin/gno that referenced this pull request Nov 27, 2026
…ritten

Only HTML white space (gnolang#9;, gnolang#10;, gnolang#12;, gnolang#13;, #Tab;, #NewLine;) decodes to
a space, as the browser shows it. #0; and gnolang#128; to gnolang#159; draw as U+FFFD or
Windows-1252 characters in a browser, so they stay as written, as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants