Skip to content

Commit d228859

Browse files
chore: lint fixes
1 parent 7cf22db commit d228859

22 files changed

Lines changed: 117 additions & 99 deletions

programs/loader-v2/Finalize.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ import (
2727
// Finalize an account loaded with program data for execution.
2828
//
2929
// Account references:
30-
// [0] = [WRITE, SIGNER] Account to prepare for execution
31-
// [1] = [] Rent sysvar
30+
//
31+
// [0] = [WRITE, SIGNER] Account to prepare for execution
32+
// [1] = [] Rent sysvar
3233
type Finalize struct {
3334
ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
3435
}
@@ -97,7 +98,7 @@ func (inst *Finalize) EncodeToTree(parent ag_treeout.Branches) {
9798
}
9899

99100
// Finalize carries no payload: the discriminant alone is the data.
100-
func (inst Finalize) MarshalWithEncoder(_ *ag_binary.Encoder) error { return nil }
101+
func (inst Finalize) MarshalWithEncoder(_ *ag_binary.Encoder) error { return nil }
101102
func (inst *Finalize) UnmarshalWithDecoder(_ *ag_binary.Decoder) error { return nil }
102103

103104
func NewFinalizeInstruction(account ag_solanago.PublicKey) *Finalize {

programs/loader-v2/Write.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ import (
2929
// Write program data into an account.
3030
//
3131
// Account references:
32-
// [0] = [WRITE, SIGNER] Account to write to
32+
//
33+
// [0] = [WRITE, SIGNER] Account to write to
3334
type Write struct {
3435
Offset *uint32
3536
Bytes []byte
@@ -78,7 +79,7 @@ func (inst Write) ValidateAndBuild() (*Instruction, error) {
7879

7980
func (inst *Write) Validate() error {
8081
if inst.Offset == nil {
81-
return errors.New("Offset parameter is not set")
82+
return errors.New("offset parameter is not set")
8283
}
8384
for i, acc := range inst.AccountMetaSlice {
8485
if acc == nil {
@@ -109,7 +110,7 @@ func (inst *Write) EncodeToTree(parent ag_treeout.Branches) {
109110
// [offset: u32 LE][len(bytes): u64 LE][bytes...]
110111
//
111112
// ag_binary's default slice encoder uses UVarInt for the length, which does
112-
// not match bincode, so Vec<u8> is serialised manually.
113+
// not match bincode, so Vec<u8> is serialized manually.
113114
func (inst Write) MarshalWithEncoder(encoder *ag_binary.Encoder) error {
114115
if err := encoder.WriteUint32(*inst.Offset, binary.LittleEndian); err != nil {
115116
return err

programs/loader-v2/instructions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ func (inst *Instruction) EncodeToTree(parent ag_treeout.Branches) {
8181
var InstructionImplDef = ag_binary.NewVariantDefinition(
8282
ag_binary.Uint32TypeIDEncoding,
8383
[]ag_binary.VariantType{
84-
{"Write", (*Write)(nil)},
85-
{"Finalize", (*Finalize)(nil)},
84+
{Name: "Write", Type: (*Write)(nil)},
85+
{Name: "Finalize", Type: (*Finalize)(nil)},
8686
},
8787
)
8888

programs/loader-v3/Close.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ import (
2828
// its lamports.
2929
//
3030
// Account references:
31-
// [0] = [WRITE] Account to close
32-
// [1] = [WRITE] Lamports recipient
33-
// [2] = [SIGNER, optional] Authority (omit for uninitialized close)
34-
// [3] = [WRITE, optional] Program (required when closing programdata)
31+
//
32+
// [0] = [WRITE] Account to close
33+
// [1] = [WRITE] Lamports recipient
34+
// [2] = [SIGNER, optional] Authority (omit for uninitialized close)
35+
// [3] = [WRITE, optional] Program (required when closing programdata)
3536
//
3637
// Tombstone (SIMD-0432): when true, the closed account is left as a
3738
// tombstone rather than fully reclaimed, blocking future re-use of the

programs/loader-v3/DeployWithMaxDataLen.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ import (
3030
// reserving `MaxDataLen` bytes for future upgrades.
3131
//
3232
// Account references:
33-
// [0] = [WRITE, SIGNER] Payer
34-
// [1] = [WRITE] ProgramData (PDA)
35-
// [2] = [WRITE] Program account
36-
// [3] = [WRITE] Source buffer
37-
// [4] = [] Rent sysvar
38-
// [5] = [] Clock sysvar
39-
// [6] = [] System program
40-
// [7] = [SIGNER] Upgrade authority
33+
//
34+
// [0] = [WRITE, SIGNER] Payer
35+
// [1] = [WRITE] ProgramData (PDA)
36+
// [2] = [WRITE] Program account
37+
// [3] = [WRITE] Source buffer
38+
// [4] = [] Rent sysvar
39+
// [5] = [] Clock sysvar
40+
// [6] = [] System program
41+
// [7] = [SIGNER] Upgrade authority
4142
//
4243
// CloseBuffer (SIMD-0430): when true, the source buffer is closed and its
4344
// lamports returned to the payer atomically with the deploy.

programs/loader-v3/ExtendProgram.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ import (
2929
// (SIMD-0431 caps the minimum granularity at MINIMUM_EXTEND_PROGRAM_BYTES).
3030
//
3131
// Account references:
32-
// [0] = [WRITE] ProgramData (PDA)
33-
// [1] = [WRITE] Program account
34-
// [2] = [optional] System program (required when payer is provided)
35-
// [3] = [WRITE, SIGNER, optional] Payer (covers any additional rent)
32+
//
33+
// [0] = [WRITE] ProgramData (PDA)
34+
// [1] = [WRITE] Program account
35+
// [2] = [optional] System program (required when payer is provided)
36+
// [3] = [WRITE, SIGNER, optional] Payer (covers any additional rent)
3637
type ExtendProgram struct {
3738
AdditionalBytes *uint32
3839

programs/loader-v3/InitializeBuffer.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ import (
2929
// and records the authority that is permitted to write to it.
3030
//
3131
// Account references:
32-
// [0] = [WRITE] Buffer account
33-
// [1] = [] Authority (not a signer here; only used to record the
34-
// authority address)
32+
//
33+
// [0] = [WRITE] Buffer account
34+
// [1] = [] Authority (not a signer here; only used to record the
35+
// authority address)
3536
type InitializeBuffer struct {
3637
ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
3738
}
@@ -88,7 +89,7 @@ func (inst *InitializeBuffer) EncodeToTree(parent ag_treeout.Branches) {
8889
})
8990
}
9091

91-
func (inst InitializeBuffer) MarshalWithEncoder(_ *ag_binary.Encoder) error { return nil }
92+
func (inst InitializeBuffer) MarshalWithEncoder(_ *ag_binary.Encoder) error { return nil }
9293
func (inst *InitializeBuffer) UnmarshalWithDecoder(_ *ag_binary.Decoder) error { return nil }
9394

9495
// NewInitializeBufferInstruction builds the InitializeBuffer instruction

programs/loader-v3/SetAuthority.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,21 @@ import (
2525
)
2626

2727
// SetAuthority changes the authority on a buffer or programdata account.
28-
// The unchecked variant is deprecated upstream in favour of
28+
// The unchecked variant is deprecated upstream in favor of
2929
// SetAuthorityChecked when setting a new non-nil authority, but it remains
3030
// the only way to clear an upgrade authority (pass nil for the new authority).
3131
//
3232
// Account references (buffer form):
33-
// [0] = [WRITE] Buffer account
34-
// [1] = [SIGNER] Current authority
35-
// [2] = [optional] New authority (omit to drop the authority)
33+
//
34+
// [0] = [WRITE] Buffer account
35+
// [1] = [SIGNER] Current authority
36+
// [2] = [optional] New authority (omit to drop the authority)
3637
//
3738
// Account references (programdata form):
38-
// [0] = [WRITE] ProgramData (PDA)
39-
// [1] = [SIGNER] Current authority
40-
// [2] = [optional] New authority (omit to make the program immutable)
39+
//
40+
// [0] = [WRITE] ProgramData (PDA)
41+
// [1] = [SIGNER] Current authority
42+
// [2] = [optional] New authority (omit to make the program immutable)
4143
type SetAuthority struct {
4244
ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
4345
}
@@ -86,11 +88,11 @@ func (inst *SetAuthority) EncodeToTree(parent ag_treeout.Branches) {
8688
})
8789
}
8890

89-
func (inst SetAuthority) MarshalWithEncoder(_ *ag_binary.Encoder) error { return nil }
91+
func (inst SetAuthority) MarshalWithEncoder(_ *ag_binary.Encoder) error { return nil }
9092
func (inst *SetAuthority) UnmarshalWithDecoder(_ *ag_binary.Decoder) error { return nil }
9193

9294
// NewSetBufferAuthorityInstruction builds a SetAuthority that transfers a
93-
// buffer's authority. Upstream deprecates this in favour of
95+
// buffer's authority. Upstream deprecates this in favor of
9496
// NewSetBufferAuthorityCheckedInstruction, but it is retained for decoding
9597
// historical transactions.
9698
func NewSetBufferAuthorityInstruction(

programs/loader-v3/SetAuthorityChecked.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ import (
2828
// must co-sign the transaction, preventing typos that would lock a program.
2929
//
3030
// Account references:
31-
// [0] = [WRITE] Target account (buffer or programdata)
32-
// [1] = [SIGNER] Current authority
33-
// [2] = [SIGNER] New authority
31+
//
32+
// [0] = [WRITE] Target account (buffer or programdata)
33+
// [1] = [SIGNER] Current authority
34+
// [2] = [SIGNER] New authority
3435
type SetAuthorityChecked struct {
3536
ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
3637
}
@@ -78,7 +79,7 @@ func (inst *SetAuthorityChecked) EncodeToTree(parent ag_treeout.Branches) {
7879
})
7980
}
8081

81-
func (inst SetAuthorityChecked) MarshalWithEncoder(_ *ag_binary.Encoder) error { return nil }
82+
func (inst SetAuthorityChecked) MarshalWithEncoder(_ *ag_binary.Encoder) error { return nil }
8283
func (inst *SetAuthorityChecked) UnmarshalWithDecoder(_ *ag_binary.Decoder) error { return nil }
8384

8485
// NewSetBufferAuthorityCheckedInstruction builds a SetAuthorityChecked that

programs/loader-v3/Upgrade.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ import (
2727
// Upgrade replaces an existing program's code with the contents of a buffer.
2828
//
2929
// Account references:
30-
// [0] = [WRITE] ProgramData (PDA)
31-
// [1] = [WRITE] Program account
32-
// [2] = [WRITE] Source buffer
33-
// [3] = [WRITE] Spill (lamports recipient)
34-
// [4] = [] Rent sysvar
35-
// [5] = [] Clock sysvar
36-
// [6] = [SIGNER] Upgrade authority
30+
//
31+
// [0] = [WRITE] ProgramData (PDA)
32+
// [1] = [WRITE] Program account
33+
// [2] = [WRITE] Source buffer
34+
// [3] = [WRITE] Spill (lamports recipient)
35+
// [4] = [] Rent sysvar
36+
// [5] = [] Clock sysvar
37+
// [6] = [SIGNER] Upgrade authority
3738
//
3839
// CloseBuffer (SIMD-0430): when true, the source buffer is closed and its
3940
// lamports sent to the spill account atomically with the upgrade.

0 commit comments

Comments
 (0)