Skip to content
Merged
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
1 change: 1 addition & 0 deletions pkg/cu/units.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const (
CUCreateProgramAddressUnits = 1500
CUSecP256k1RecoverCost = 25000
CUInvokeUnits = 1000
CUInvokeUnitsSimd0339 = 946
CUConfigProcessorDefaultComputeUnits = 450
CUSystemProgramDefaultComputeUnits = 150
CUVoteProgramDefaultComputeUnits = 2100
Expand Down
11 changes: 9 additions & 2 deletions pkg/sealevel/syscalls_cpi.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,13 @@ func checkAccountInfos(execCtx *ExecutionCtx, numAccountInfos uint64) error {
return nil
}

func cpiInvokeUnits(f *features.Features) uint64 {
if f != nil && f.IsActive(features.IncreaseCpiAccountInfoLimit) {
return cu.CUInvokeUnitsSimd0339
}
return cu.CUInvokeUnits
}

func translateAccountInfosC(vm sbpf.VM, accountInfosAddr, accountInfosLen uint64) ([]SolAccountInfoC, []solana.PublicKey, error) {
size := safemath.SaturatingMulU64(accountInfosLen, SolAccountInfoCSize)
accountInfosData, err := vm.Translate(accountInfosAddr, size, false)
Expand Down Expand Up @@ -788,7 +795,7 @@ func translateAccountsRust(vm sbpf.VM, instructionAccts []InstructionAccount, pr
// SyscallInvokeSignedCImpl is an implementation of the sol_invoke_signed_c syscall
func SyscallInvokeSignedCImpl(vm sbpf.VM, instructionAddr, accountInfosAddr, accountInfosLen, signerSeedsAddr, signerSeedsLen uint64) (uint64, error) {
execCtx := executionCtx(vm)
err := execCtx.ComputeMeter.Consume(cu.CUInvokeUnits)
err := execCtx.ComputeMeter.Consume(cpiInvokeUnits(&execCtx.Features))
if err != nil {
return syscallCuErr()
}
Expand Down Expand Up @@ -866,7 +873,7 @@ func SyscallInvokeSignedRustImpl(vm sbpf.VM, instructionAddr, accountInfosAddr,
//mlog.Log.Debugf("SyscallInvokeSignedRust")

execCtx := executionCtx(vm)
err := execCtx.ComputeMeter.Consume(cu.CUInvokeUnits)
err := execCtx.ComputeMeter.Consume(cpiInvokeUnits(&execCtx.Features))
if err != nil {
return syscallCuErr()
}
Expand Down
Loading