Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/multiversx/mx-chain-scenario-go v1.8.0
github.com/multiversx/mx-chain-storage-go v1.2.0
github.com/multiversx/mx-chain-vm-common-go v1.7.3
github.com/multiversx/mx-components-big-int v1.2.0
github.com/multiversx/mx-components-big-int v1.3.0
github.com/pelletier/go-toml v1.9.5
github.com/stretchr/testify v1.11.1
github.com/urfave/cli/v2 v2.27.7
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ github.com/multiversx/mx-chain-storage-go v1.2.0 h1:c+T7NJdsnbZza5k7ez/pUEHeAT9B
github.com/multiversx/mx-chain-storage-go v1.2.0/go.mod h1:jzaisAV6n/TdrQpYiMX/+A35yl9Cd8LAG+4Afqi6J5s=
github.com/multiversx/mx-chain-vm-common-go v1.7.3 h1:vuxVaf02XV6rt2EOiF4HMGEVqYfykNghCD0chBSw+vA=
github.com/multiversx/mx-chain-vm-common-go v1.7.3/go.mod h1:Lk2ZNxVCThYFbFhjXxy1S8PwqjcEnF7uvTQ0QvA4BbQ=
github.com/multiversx/mx-components-big-int v1.2.0 h1:PppI54XUxmghhFhsK4mT6pG/Ev9OuZKKlbKUfpsXklg=
github.com/multiversx/mx-components-big-int v1.2.0/go.mod h1:HhZ2YdqsweLoOXeSufOTmDOdfyckZ1uBDSnr8n4tOe8=
github.com/multiversx/mx-components-big-int v1.3.0 h1:YBAdMCWlK55Dr2u0qQQeX7QSjPkLCqQQYozdoFoa7ms=
github.com/multiversx/mx-components-big-int v1.3.0/go.mod h1:HhZ2YdqsweLoOXeSufOTmDOdfyckZ1uBDSnr8n4tOe8=
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
Expand Down
47 changes: 0 additions & 47 deletions math/twosComplement.go

This file was deleted.

156 changes: 0 additions & 156 deletions math/twosComplement_test.go

This file was deleted.

5 changes: 2 additions & 3 deletions vmhost/vmhooks/baseOps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/multiversx/mx-chain-vm-go/config"
"github.com/multiversx/mx-chain-vm-go/executor"
"github.com/multiversx/mx-chain-vm-go/math"
mockcontext "github.com/multiversx/mx-chain-vm-go/mock/context"
twos "github.com/multiversx/mx-components-big-int/twos-complement"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -98,11 +97,11 @@ func TestBigIntByteLength_MatchesBytesHooks(t *testing.T) {

for _, tc := range testCases {
// BigIntGetUnsignedBytes / BigIntFinishUnsigned write value.Bytes()
require.Equal(t, len(tc.Bytes()), math.UnsignedByteLength(tc),
require.Equal(t, len(tc.Bytes()), twos.UnsignedByteLength(tc),
"unsigned length mismatch for value %s", tc.String())

// BigIntGetSignedBytes / BigIntFinishSigned write twos.ToBytes(value)
require.Equal(t, len(twos.ToBytes(tc)), math.TwosComplementByteLength(tc),
require.Equal(t, len(twos.ToBytes(tc)), twos.ByteLength(tc),
"signed length mismatch for value %s", tc.String())
}
}
Expand Down
4 changes: 2 additions & 2 deletions vmhost/vmhooks/bigIntOps.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func (context *VMHooksImpl) BigIntUnsignedByteLength(referenceHandle int32) int3
return -1
}

return int32(math.UnsignedByteLength(value))
return int32(twos.UnsignedByteLength(value))
}

// BigIntSignedByteLength VMHooks implementation.
Expand All @@ -362,7 +362,7 @@ func (context *VMHooksImpl) BigIntSignedByteLength(referenceHandle int32) int32
// the two's complement representation is deliberately not built here: its length
// can be computed from the bit length alone, and materializing it would allocate
// proportionally to the value while only a flat gas cost is charged
return int32(math.TwosComplementByteLength(value))
return int32(twos.ByteLength(value))
}

// BigIntGetUnsignedBytes VMHooks implementation.
Expand Down
Loading