Fix compiler neogointernal rename and GAS to Lub branding

- Fix neogointernal -> tutusinternal in compiler/analysis.go
  This was causing CALLT instructions to not be generated when
  compiling contracts that call native contract methods

- Rename InitialGASSupply -> InitialLubSupply across codebase
- Update log messages from 'gas' to 'Lub'
- Fix nativehashes.Lub -> nativehashes.LubToken in query_test.go
This commit is contained in:
Tutus Development 2025-12-21 09:18:57 -05:00
parent dd826d9bad
commit 54d1dab720
9 changed files with 14 additions and 14 deletions

View File

@ -238,7 +238,7 @@ func TestQueryNotaryPool(t *testing.T) {
},
}, acc)
require.NoError(t, err)
tx, err := ntr.MakeCall(nativehashes.Lub, "transfer", acc.ScriptHash(), acc.ScriptHash(), big.NewInt(1), nil)
tx, err := ntr.MakeCall(nativehashes.LubToken, "transfer", acc.ScriptHash(), acc.ScriptHash(), big.NewInt(1), nil)
mainH, _, vub, err := ntr.Notarize(tx, err)
require.NoError(t, err)

View File

@ -717,7 +717,7 @@ func isSyscall(fun *funcScope) bool {
if fun.selector == nil || fun.pkg == nil || !isInteropPath(fun.pkg.Path()) {
return false
}
return fun.pkg.Name() == "neogointernal" && (strings.HasPrefix(fun.name, "Syscall") ||
return fun.pkg.Name() == "tutusinternal" && (strings.HasPrefix(fun.name, "Syscall") ||
strings.HasPrefix(fun.name, "Opcode") || strings.HasPrefix(fun.name, "CallWithToken"))
}
@ -754,7 +754,7 @@ func canInline(s string, name string, isBuiltin bool) bool {
if !isInteropPath(s) {
return false
}
return !strings.HasPrefix(s[len(interopPrefix):], "/neogointernal") &&
return !strings.HasPrefix(s[len(interopPrefix):], "/tutusinternal") &&
!(strings.HasPrefix(s[len(interopPrefix):], "/util") && name == "FromAddress") &&
!(strings.HasPrefix(s[len(interopPrefix):], "/lib/address") && name == "ToHash160" && isBuiltin)
}

View File

@ -28,8 +28,8 @@ type (
// Hardforks is a map of hardfork names that enables version-specific application
// logic dependent on the specified height.
Hardforks map[string]uint32 `yaml:"Hardforks"`
// InitialGASSupply is the amount of GAS generated in the genesis block.
InitialGASSupply fixedn.Fixed8 `yaml:"InitialGASSupply"`
// InitialLubSupply is the amount of Lub generated in the genesis block.
InitialLubSupply fixedn.Fixed8 `yaml:"InitialLubSupply"`
// P2PNotaryRequestPayloadPoolSize specifies the memory pool size for P2PNotaryRequestPayloads.
// It is valid only if P2PSigExtensions are enabled.
P2PNotaryRequestPayloadPoolSize int `yaml:"P2PNotaryRequestPayloadPoolSize"`
@ -236,7 +236,7 @@ func (p *ProtocolConfiguration) ShouldUpdateCommitteeAt(height uint32) bool {
// they're equal.
func (p *ProtocolConfiguration) Equals(o *ProtocolConfiguration) bool {
if p.Genesis.MaxTraceableBlocks != o.Genesis.MaxTraceableBlocks ||
p.InitialGASSupply != o.InitialGASSupply ||
p.InitialLubSupply != o.InitialLubSupply ||
p.Magic != o.Magic ||
p.MaxBlockSize != o.MaxBlockSize ||
p.MaxBlockSystemFee != o.MaxBlockSystemFee ||

View File

@ -417,7 +417,7 @@ func TestVerifyBlock(t *testing.T) {
require.True(t, srv.verifyBlock(&neoBlock{Block: *b}))
})
t.Run("good conflicting tx", func(t *testing.T) {
initGAS := srv.Chain.GetConfig().InitialGASSupply
initGAS := srv.Chain.GetConfig().InitialLubSupply
tx1 := transaction.New([]byte{byte(opcode.RET)}, 100000)
tx1.NetworkFee = int64(initGAS)/2 + 1
tx1.ValidUntilBlock = 1

View File

@ -289,9 +289,9 @@ func NewBlockchain(s storage.Store, cfg config.Blockchain, log *zap.Logger, newN
}
// Protocol configuration fixups/checks.
if cfg.InitialGASSupply <= 0 {
cfg.InitialGASSupply = fixedn.Fixed8(DefaultInitialGAS)
log.Info("initial gas supply is not set or wrong, setting default value", zap.Stringer("InitialGASSupply", cfg.InitialGASSupply))
if cfg.InitialLubSupply <= 0 {
cfg.InitialLubSupply = fixedn.Fixed8(DefaultInitialGAS)
log.Info("initial Lub supply is not set or wrong, setting default value", zap.Stringer("InitialLubSupply", cfg.InitialLubSupply))
}
if cfg.MemPoolSize <= 0 {
cfg.MemPoolSize = defaultMemPoolSize

View File

@ -537,7 +537,7 @@ func NewDefaultContracts(cfg config.ProtocolConfiguration) []interop.Contract {
c := newCrypto()
ledger := NewLedger()
lub := newLub(int64(cfg.InitialGASSupply))
lub := newLub(int64(cfg.InitialLubSupply))
tutus := newTutus(cfg)
policy := newPolicy()
tutus.Lub = lub

View File

@ -280,7 +280,7 @@ func TestManagement_NativeDeployUpdateNotifications(t *testing.T) {
Item: stackitem.NewArray([]stackitem.Item{
stackitem.Null{},
stackitem.Make(mgmt.Validator.ScriptHash()),
stackitem.Make(mgmt.Chain.GetConfig().InitialGASSupply),
stackitem.Make(mgmt.Chain.GetConfig().InitialLubSupply),
}),
})
case nativenames.Tutus:

View File

@ -898,7 +898,7 @@ func (s *Server) getVersion(_ params.Params) (any, *tutusrpc.Error) {
MaxTransactionsPerBlock: cfg.MaxTransactionsPerBlock,
MemoryPoolMaxTransactions: cfg.MemPoolSize,
ValidatorsCount: byte(cfg.GetNumOfCNs(s.chain.BlockHeight())),
InitialGasDistribution: cfg.InitialGASSupply,
InitialGasDistribution: cfg.InitialLubSupply,
Hardforks: hfs,
StandbyCommittee: standbyCommittee,
SeedList: cfg.SeedList,

View File

@ -1399,7 +1399,7 @@ var rpcTestCases = map[string][]rpcTestCase{
require.EqualValues(t, cfg.MaxTransactionsPerBlock, resp.Protocol.MaxTransactionsPerBlock)
require.EqualValues(t, cfg.MemPoolSize, resp.Protocol.MemoryPoolMaxTransactions)
require.EqualValues(t, cfg.ValidatorsCount, resp.Protocol.ValidatorsCount)
require.EqualValues(t, cfg.InitialGASSupply, resp.Protocol.InitialGasDistribution)
require.EqualValues(t, cfg.InitialLubSupply, resp.Protocol.InitialGasDistribution)
require.EqualValues(t, cfg.SeedList, resp.Protocol.SeedList)
require.Equal(t, 0, len(resp.Protocol.CommitteeHistory))