Instruction: SetAuthority Error: owner does not match - solana

I get this error when trying to mint master edition nft using CPI of the metaplex program
Program log: Setting mint authority
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]
Program log: Instruction: SetAuthority
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1929 of 116474 compute units
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success
Program log: Setting freeze authority
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]
Program log: Instruction: SetAuthority
Program log: Error: owner does not match
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1816 of 111354 compute units
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: custom program error: 0x4
Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 34531 of 144069 compute units
this is the code where the error pops up specifically at the create master edition invoking part
let master_edition_infos = vec![
ctx.accounts.master_edition.to_account_info(),
ctx.accounts.mint.to_account_info(),
ctx.accounts.mint_authority.to_account_info(),
ctx.accounts.payer.to_account_info(),
ctx.accounts.metadata.to_account_info(),
ctx.accounts.token_metadata_program.to_account_info(),
ctx.accounts.token_program.to_account_info(),
ctx.accounts.system_program.to_account_info(),
ctx.accounts.rent.to_account_info(),
];
invoke(
&create_master_edition_v3(
ctx.accounts.token_metadata_program.key(),
ctx.accounts.master_edition.key(),
ctx.accounts.mint.key(),
ctx.accounts.payer.key(),
ctx.accounts.mint_authority.key(),
ctx.accounts.metadata.key(),
ctx.accounts.payer.key(),
Some(0),
),
master_edition_infos.as_slice(),
)?;
this is the data im passing thru the client side
(await program.rpc.mintTicket({
accounts: {
mintAuthority: program.provider.wallet.publicKey,
eventAccount: eventPDA,
mint: mintKey.publicKey,
tokenAccount: NftTokenAccount,
tokenProgram: TOKEN_PROGRAM_ID,
metadata: metadataAddress,
tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID,
payer: program.provider.wallet.publicKey,
systemProgram: SystemProgram.programId,
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
masterEdition: masterEdition,
},
}));
these are the accounts/pubkeys
Program Id: Crvo7H5Qupi7pD63wyyXfoPbzAkU9Hbqwno7xTrXLbKo
Event PDA: 4U1p28aYRULrkfWgUrspqPEpyauXEQRY2pAyBYhXSdhy
NFT Account: BBqs3FzBk74FGJtQ2XQbz8ZiDq9iaTBL78obSL6xhuvq
Parsed account:3XAzUULWFYkKjRGAF9LXdY21XPsvRBNSadNWXd6qCsXTSagKJVQc9U8wziuj483yy3y1JAKkzQuyhZj4G2cjdM2a
Mint key: 7hormNKw6RcX2jEBjLLdLdzb6JvHK7oN3PymDjxdbFdh
User: 7CtWnYdTNBb3P9eViqSZKUekjcKnMcaasSMC7NbTVKuE
Metadata address: Envsbupi5iaCaoZ2eFAsr1ZiM1qUZCB1tiZVygY3GrpS
MasterEdition: AX4VN8LN5B8xoHkf6kbLMTmF5RBiKcfi2QJt6fnCiJCL
And I think the issue is to do with the fact that the mint address(explorer_link) has mint authority set to the user but update authority is not the user although im not sure and would appreciate any help

ok i fixed this issue it was my mistake when i ran this function on the client side i gave it the wrong key for freeze authority
createInitializeMintInstruction(
mintKey.publicKey,
0,
program.provider.wallet.publicKey,
program.provider.wallet.publicKey // works now but before was mintKey.publicKey
),
i accidentaly added mint key as freeze authority instead of users key

Related

How to serialize anchor instruction from non-anchor contract

I am trying to invoke Anchor-contract from a regular solana contract and i am keep getting the error
Program log: AnchorError occurred. Error Code: InstructionMissing. Error Number: 100. Error Message: 8 byte instruction identifier not provided.
This is my instruction
#[derive(Debug, BorshDeserialize, BorshSerialize, PartialEq)]
pub enum ConfigInstruction {
Initialize,
}
pub fn initialize(
program_id: &Pubkey,
config: &Pubkey,
authority: &Pubkey,
) -> Instruction {
let accounts = vec![
AccountMeta::new(*config, true),
AccountMeta::new(*authority, true),
AccountMeta::new_readonly(system_program::id(), false),
];
Instruction::new_with_borsh(
*program_id,
&ConfigInstruction::Initialize,
accounts,
)
}
Seems like anchor is waiting a 8-byte long encoded instruction. While borsh serializes it to a vector with size 1. Any idea what am i doing wrong?
Really took some time to sort this out. Posting so this might be helpful for someone else.
So in order to use anchor's instruction for non-anchor contract you need to import InstructionData trait
use anchor_lang::InstructionData;
You instructions will be available using
use your_anchor_program::instruction::CamelCaseInstructionName
Create instruction as usual
Instruction {
program_id: *program_id,
accounts: vec![
...
],
data: CamelCaseInstructionName.data(),
}

Why can't whiltelist mint in candymachine UI?

I am a beginner of metaplex.
What I want to achieve is to provide the feature of presale, which means white list!.
I followed the instruction in metaplex to set config.json.
}
"whitelistMintSettings": {
"mode" : { "neverBurn": true },
"mint" : "xxxxKnH5",
"presale" : true,
"discountPrice" : 0.5
},
Here, I set xxxxKnH5 as a member of whitelist and let him mint before public mint.
Then I update_candy_machine (this works fine).
But in the UI interface, I always got error message:
There was a problem fetching whitelist token balance
Home.tsx:184 Error: failed to get token account balance: Invalid param: could not find account
Any idea of why I received this message and how can I fix it?
Make sure that the "mint": "XXX...X", line should contain a 0 decimals SPL-TOKEN.
Moreover, for airdropping it to users, you join the Metaplex Discord server and check the #airdrop-bash thread. It contains a JS script that'll make airdropping the token to wallets alot easier:)

Rllib & Remote Desktop Connection: [Errno 10054] An existing connection was forcibly closed by the remote host

The general setting:
I am currently running several rllib processes on the machine at my workplace. The goal is to run multi-agent reinforcement learning simulations with a varying number of agents, differing start states and three different configurations. The computer only has the capacity to run one process at a time, which is why I loop through all configurations to allow for overnight and weekend simulations.
The Problem:
To oversee the process (e.g. if there are any problems with disk space) off work I have configured a remote desktop connection. Now after approximately 6-8 hours of running following error message is produced:
2022-06-08 08:01:04,008 ERROR worker.py:1259 -- listen_error_messages_raylet: [WinError 10054] Eine vorhandene Verbindung wurde vom Remotehost geschlossen
2022-06-08 08:01:04,008 ERROR worker.py:488 -- print_logs: [WinError 10054] Eine vorhandene Verbindung wurde vom Remotehost geschlossen
[2022-06-08 08:02:04,321 C 4548 1908] gcs_client.cc:343: Couldn't reconnect to GCS server. The last attempted GCS server address was 127.0.0.1:61369
*** StackTrace Information ***
Windows fatal exception: access violation
Translation: Eine vorhandene Verbindung wurde vom Remotehost geschlossen => An existing connection was forcibly closed by the remote host
The code:
Here is my code, even though I believe that it must have something to do with the Windows Remote Desktop connection or with the GCS server (no idea what this is or what I need it for actually):
def main(debug, framework="tf"):
n_agents = [8, 16, 32, 64]
init_state = [0.1, 0.25, 0.5, 1., 2.]
tax = ["none", "vote", "central"]
for n in n_agents:
for s in init_state:
for t in tax:
shutdown()
register_env(args.env_name, lambda cnfg: ParallelPettingZooEnv(env_creator(cnfg)))
train_n_replicates = 1 if debug else 10
seeds = list(range(train_n_replicates))
ray.init(num_cpus=os.cpu_count(), num_gpus=0, local_mode=debug)
rllib_config, stop_config = get_rllib_config(seeds=seeds,
n_agents=n,
init_state=s,
tax=t,
debug=debug,
framework=framework)
# Define logger to use (e.g. which output formats)
custom_logger = LifecycleLoggerCallback(
logger_classes=[CSVLogger, TBXLogger],
)
log_dir = os.path.join(os.getcwd(), "run_configurations/checkpoints")
tune_analysis = tune.run(
args.run,
config=rllib_config,
stop=stop_config,
checkpoint_freq=0,
checkpoint_at_end=True,
name=args.experiment_name,
local_dir=log_dir,
callbacks=[custom_logger],
trial_name_creator=trial_str_creator,
raise_on_failed_trial=False,
)
ray.shutdown()
for i in range(len(tune_analysis.trials)):
results_path = os.path.join(log_dir, args.experiment_name, str(tune_analysis.trials[i].logdir))
results_to_csv(results_path)
if __name__ == "__main__":
debug_mode = False
args = parser.parse_args()
main(debug_mode, args.framework)
P.S.: I run the PPO RLlib-registered algorithm.
Grateful for any tips. Cheers :)

Saltstack user.present does not set uid while creating the user

My goal is to have a user with a given uid. I try to have a simple user created with the very basic state:
Add Student:
user.present:
- name: Student
- uid: 333123123123
- allow_uid_change: True
333123123123 is just some dummy value. I'd like something more meanigful later, but this is what I use for testing.
This creates the user perfectly fine, but with generated uid:
ID: Add Student
Function: user.present
Name: Student
Result: True
Comment: New user Student created
Started: 19:47:33.543457
Duration: 203.157 ms
Changes:
----------
account_disabled:
False
account_locked:
False
active:
True
comment:
description:
disallow_change_password:
False
expiration_date:
2106-02-07 07:28:15
expired:
True
failed_logon_attempts:
0
fullname:
Student
gid:
groups:
home:
homedrive:
last_logon:
Never
logonscript:
name:
Student
passwd:
None
password_changed:
2022-02-21 19:47:33
password_never_expires:
False
profile:
None
successful_logon_attempts:
0
uid:
S-1-5-21-3207633127-2685365797-3805984769-1043
Summary
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
Total run time: 203.157 ms
Now, if I try running state.apply again, I get the following message:
ID: Add Student
Function: user.present
Name: Student
Result: False
Comment: Encountered error checking for needed changes. Additional info follows:
- Changing uid (S-1-5-21-3207633127-2685365797-3805984769-1043 -> 333123123123) not permitted, set allow_uid_change to True to force this change. Note that this will not change file ownership.
Started: 19:47:45.503643
Duration: 7000.025 ms
Changes:
Summary
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
Total run time: 7.000 s
So it IS being considered, checked and verified - but not working while creating the user. The syntax seems to be confirmed. Why is it not getting applied upon creating the user?
It is possible to change a user's SID, but it requires unsupported registry hacking. Creating a new user with a specific SID would be even harder. Salt won't do that.
If you need to know the SID of a Windows user, you have to create it first and then query it. If you need it in a following state in the same run, then you can use slots.

AES GCM decrypt Firefox error only: "DOMException: The operation failed for an operation-specific reason", Chromium OK though

I followed former answers from Webcrypto AES-CBC Decrypt: Operation Error - The operation failed for an operation-specific reason and JavaScript AES encryption and decryption (Advanced Encryption Standard)
and used:
iv = crypto.getRandomValues(new Uint8Array(16))
key = window.crypto.subtle.generateKey(
{
name: "AES-GCM",
length: 256,
},
false,
["encrypt", "decrypt"]
)
to generate the key
and
Uint8ArrayEncrypted = window.crypto.subtle.encrypt(
{name: "aes-gcm", iv: iv, tagLength: 128},
key,
Uint8ArrayVar)
to encrypt and
Uint8ArrayDecrypted = window.crypto.subtle.decrypt(
{name: "aes-gcm", iv: iv, tagLength: 128},
key,
Uint8ArrayEncrypted)
to decrypt
On Chromium 83 (Ubuntu) and Firefox 88, I successfully generate the key, the iv and encrypt.
And on Chromium, it simply also decrypts without problem.Uint8ArrayDecrypted is correct ArrayBuffer.
But FF throws the error "The operation failed for an operation-specific reason" and stop there. No Uint8ArrayDecrypted returned.
I didn't use tag, like in WebCrypto API: DOMException: The provided data is too small
Reading https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt,
I don't see it uses tag.
Does Firefox need something else specific?
Why the error message is so "generic"? Which operation or specific reason?
With an error so generic, I don't know where to look.

Resources